- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
编辑 - 如下面的代码所示,模态将工作 - 我的问题是我在我的模态的 HTML 模板中包含了 ng-app 和 ng-controller,但是它们不包含在下面的问题中。
我有我的主 Controller 、模态 Controller 和我的模态模板 HTML
一切似乎都井井有条,我终生无法解决(或从 stackoverflow 中找出)为什么我一直收到 Error: [$injector:unpr] Unknown provider: modalInstanceProvider <- modalInstance <- modalCtrl
错误。顺便说一句 $modal
现在已被删除,它是 $ubiModal
现在。
主控:
var module = angular.module("app", ["agGrid", "ngAnimate", "ngSanitize", "ngDialog", "ui.bootstrap"])
module.controller("mainCtrl", ["$scope", "dataService", "$timeout", "dateFilter", "ngDialog", "$http", "$uibModal", function ($scope, dataService, $timeout, dateFilter, ngDialog, $http, $uibModal) {
$scope.open = function () {
var uibModalInstance= $uibModal.open({
templateUrl: "views/Modal.html",
controller: "modalCtrl",
show: true,
})
};
}]);
我的模态 Controller :
module.controller("modalCtrl", ["$scope", "ngDialog", "dataService", "$uibModalInstance", function ($scope, ngDialog, dataService, $uibModalInstance) {
//do stuff
}]);
和我的 HTML 模板:
<div id="loginModal" class="modal show" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" ng-click="closeThisDialog(); printArray()" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h1 class="text-center" style="text-align: center">Entities:</h1>
</div>
<div class="modal-body">
<div>
<div>
<input type="text" placeholder="Search" ng-model="entity">
</div>
</div>
<div ng-repeat="entity in entityArray | filter:entity">
<label>
<input style="float: left; margin-top: 5px" type="checkbox" ng-model="entityChecked" ng-change="getEntityFromModal(entity, entityChecked)" />
<span>{{entity}}</span>
</label>
</div>
</div>
<button ng-click="okButtonEntity();" >OK</button>
</div>
</div>
</div>
最佳答案
$modalInstance
已更改(弃用)为带有最新的 ui Bootstrap (0.14.3) 的 $uibModalInstance
。它也应该是旧版本的 $modalInstance
。
即
module.controller("modalCtrl", ["$scope", "ngDialog", "dataService", "$uibModalInstance",
function ($scope, ngDialog, dataService, $uibModalInstance) {
controller - a controller for a modal instance - it can initialize scope used by modal. Accepts the "controller-as" syntax in the form 'SomeCtrl as myctrl'; can be injected with $uibModalInstance
关于javascript - 错误 : [$injector:unpr] Unknown provider: modalInstanceProvider <- modalInstance <- modalCtrl with the latest ui bootstrap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33438018/
$injector.instantiate有什么区别, $injector.get和 $injector.invoke在 AngularJS 中? 最佳答案 鉴于以下服务: app.service('
我尝试使用两种方式显式创建依赖关系。两者几乎相同,但我有点困惑使用反射注入(inject)器比普通注入(inject)器有什么优势,推荐使用哪种方式? 使用注入(inject)器 import { I
我对 Angular js 很陌生,以下是我的代码 (function(angular){ var testAngular = angular.mo
在英雄之旅教程的第 5 节中,main.dart 包含以下行: final InjectorFactory injector = self.injector$Injector; 这是错字吗?它在 VS
你好我是 Angular JS 的初学者,当我开始创建模块和 Controller 时,我无法打印我的消息,下面是我的代码 var myModule = angular.module("myFirst
我只是想在 Angular Dart 中尝试路由。我在关注这个https://webdev.dartlang.org/angular/guide/router/1指导,但我收到错误。 这一行给出错误
自从我设置一个与 Angular 一起运行的网络应用程序以来已经有一段时间了。我正在通过一个旧项目回顾我的步骤(尝试在我正在做的页面上实现一个 Controller ,确保 Controller 文件
我正在尝试学习 Angular,但无法正确加载它。我看了一下关于 SO 的类似问题,但找不到我要找的东西。 有人知道为什么会出现这个错误吗?在我看来,我是否正确地调用了我的新应用程序/模块?我的剧本错
我使用环回作为后端,使用 postgresql 作为数据库。所以我尝试使用 lb-service/js。 如果我尝试在 login.js 中包含 lbServices (angular.module(
我正在尝试将表情符号应用程序注入(inject)我的项目。 我添加了emoji.min.js并像这样引用它 现在我也将它注入(inject)到我的项目中,如下所示: angular.module('
当我尝试将 $cookie 包含到我的 Controller 中时出现此错误。 任何人都可以向我解释我做错了什么? 我在 index.html 中有 angular-cookie.js 我在 conf
我正在使用 anguarjs 开发一个应用程序,并出现如下错误: 无法实例化模块 myApp,原因是:错误:[$injector:modulerr] http://errors.angularjs.o
var demoapp = angular.module('demoapp', []); demoapp.controller('SimpleC
我正在尝试通过网络摄像头简单地读取二维码,但我在控制台打开 Angular 帮助页面时遇到此错误,但说使用 ngRoute Error: [$injector:modulerr] http://err
我正在尝试对此进行编码,只是使用路由从第一个页面跳转到另一个页面,但为什么它不起作用,我搜索并使用了很多技巧但仍然失败,请问有人吗? index.html Angular Js
我收到此错误: ncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to: Error: [$inje
我正在尝试创建一个带有 Angular 路由的 SPA(单页应用程序),但是当我将 ndRoute 添加到我的模块时,它给了我这个错误 Uncaught Error: [$injector:modul
this is the error i m getting.这个问题被问了很多次。但是下面的代码在在线编译器中运行良好,但在我的本地系统中运行不佳,即使系统已连接到互联网,它也显示未定义 Angula
我正在尝试学习 Angular 并尝试在基于 Web 的教程之外编写我的第一个 Controller 。我一直在 JS 控制台的标题中收到错误消息,无法弄清楚发生了什么。该链接将我带到一个引用需要包含
我在尝试编写代码时遇到此错误。我已经完成了其他 Stackflow 问题,但找不到答案。是什么导致了这个错误? var app = angular.module("app", ['ui.router'
我是一名优秀的程序员,十分优秀!