AngularJS$Modal本身未定义
AngularJS $Modal itself is undefined
我试图使用Angular制作我的第一个模态,但似乎连$modal
都找不到!这是我的代码:
myController = ($scope, $modal) ->
$scope.OpenModal = ->$modal.open(
templateUrl: 'Modal.html'
)
HTML指向OpenModal
函数如下-
<div ng-controller="myController">
<button ng-click="OpenModal()">Modal</button>
</div>
但当我点击按钮时,我会得到错误Cannot read property 'open' of undefined
。为什么?难道不应该注入modal
对象吗?
我发现了这个问题。我已经在我的应用程序中包含了ui.bootstrap
,但我忘记将$modal
放在控制器依赖项中。
相关文章:
- 为什么“;未定义的“;在JavaScript中结束循环
- 要求未定义JS回调参数
- 如何检查管道中未定义的项目
- TypeError:无法读取属性'推'未定义的JavaScript
- $window.ga在AngularJS事件中未定义
- 未捕获的TypeError无法读取未定义的属性socialsharing
- 为什么grunt contrib connect的中间件选项的第三个参数是未定义的
- 无法获取属性'selectedIndex'的未定义引用或null引用
- 如何消除代码中的未定义和其他问题
- 未捕获的ReferenceError:$未定义
- this.router在AngularJS 2中未定义
- 未捕获的类型错误:无法读取属性'删除'的未定义
- 节点fs.stat名称未定义
- 尝试在PHP中回显输入文本时出现未定义的索引错误
- Jquery未定义函数正在停止其他操作
- AngularJS指令出错-无法读取属性'编译'的未定义
- 这.SOMETHING 总是返回未定义的 - extjs
- 理解modal.js中的未定义方法
- AngularJS$Modal本身未定义
- 未捕获的类型错误:Bootstrap Modal未定义