未知提供商:$ modalProvider< - $用AngularJS模式错误 [英] Unknown provider: $modalProvider <- $modal error with AngularJS

查看:803
本文介绍了未知提供商:$ modalProvider< - $用AngularJS模式错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在为我试图实现自举模式窗口收到此错误。可能是什么它的原因是什么?我从<复制/粘贴的一切href=\"http://angular-ui.github.io/bootstrap/#/modal\">http://angular-ui.github.io/bootstrap/#/modal在这里。

I keep receiving this error as I'm trying to implement bootstrap Modal window. What could be the cause of it? I've copy/pasted everything from http://angular-ui.github.io/bootstrap/#/modal here.

推荐答案

当你在一个控制器,服务等的依赖写操作发生这种错误,并且您尚未创建或包括该相关性。

This kind of error occurs when you write in a dependency for a controller, service, etc, and you haven't created or included that dependency.

在这种情况下, $模式不是一个已知的服务。这听起来像白手创业的角度,当你没有在UI的引导通作为一个依赖。 angular.module('Mymodule中',['ui.bootstrap']); 另外,确保您使用的是最新版本的UI自举(0.6.0),为了安全起见。

In this case, $modal isn't a known service. It sounds like you didn't pass in ui-bootstrap as a dependency when bootstrapping angular. angular.module('myModule', ['ui.bootstrap']); Also, be sure you are using the latest version of ui-bootstrap (0.6.0), just to be safe.

该错误是扔在0.5.0版本,但更新到0.6.0确实让现有的$模式服务。因此,更新到0.6.0版本,并确保注册您的模块时,需要ui.boostrap。

The error is thrown in version 0.5.0, but updating to 0.6.0 does make the $modal service available. So, update to version 0.6.0 and be sure to require ui.boostrap when registering your module.

回复您的评论:这是你如何注入一个模块依赖

Replying to your comment: This is how you inject a module dependency.

<!-- tell Angular what module we are bootstrapping -->
<html ng-app="myApp" ng-controller="myCtrl">

JS:

// create the module, pass in modules it depends on
var app = angular.module('myApp', ['ui.bootstrap']);

// $modal service is now available via the ui.bootstrap module we passed in to our module
app.controller('myCtrl', function($scope, $modal) {

});

更新:

$模式服务已更名为 $ uibModal

这篇关于未知提供商:$ modalProvider&LT; - $用AngularJS模式错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆