简体   繁体   English

v1.0.8中弃用了$ dialog注入

[英]$dialog injection deprecated in v1.0.8

I'm new to angular and have inherited a project so apologies in advance if this is a basic/bad question. 我是新来的有角度的人,并且已经继承了一个项目,因此如果这是一个基本/不好的问题,请提前道歉。 I have a controller 我有一个控制器

.controller('myCtrl', function($dialog) {}

thats causing the error 多数民众赞成在导致错误

Error: Unknown provider: $dialogProvider <- $dialog

on another machine with angular 1.0.7 $dialog seems to originate from angular ui-bootstrap.js but is gone from 1.0.8. 在另一台角度为1.0.7的机器上,$ dialog似乎起源于angular ui-bootstrap.js,但已从1.0.8删除。 If this feature is deprecated does anyone have a suggestion of how to replace it? 如果不建议使用此功能,是否有人建议更换它?

Thanks in advance 提前致谢

C C

Assuming that we are speaking about the $dialog service from http://angular-ui.github.io/bootstrap/ than the $dialog service (and hence your error) has absolutely nothing to do with the AngularJS version. 假设我们正在谈论的是来自http://angular-ui.github.io/bootstrap/$dialog服务,而不是$dialog服务(因此会引起您的错误)与AngularJS版本无关。

In the http://angular-ui.github.io/bootstrap/ the version 0.6.0 of the library brought complete rewrite of the $dialog service. http://angular-ui.github.io/bootstrap/中,库的0.6.0版完全重写了$dialog服务。 During the rewrite it was renamed to $modal and its API has change in the non-backward-compatible way (although $modal and $dialog APIs are still pretty close so migration shouldn't be too painful). 在重写过程中,它被重命名为$modal并且其API以非向后兼容的方式进行了更改(尽管$ modal和$ dialog API仍然非常接近,因此迁移不会太麻烦)。

So, what I presume is that you've updated to the latest angular-ui/bootstrap version (0.6.0) and this is why you are seeing this error. 因此,我认为您已经更新到最新的angular-ui / bootstrap版本(0.6.0),这就是为什么您看到此错误的原因。 To get rid of it either downgrade to 0.5.0 or change your calls to use the new $modal service. 要摆脱它,可以降级到0.5.0或更改您的调用以使用新的$ modal服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM