我正在尝试使用$mdDialog在我的角1.5应用程序,我有一些问题。我确信我错过了一些简单的东西,但我不能把手指放在上面。
我宣布我的应用程序为:
var module = angular.module('myApp', ['ngMaterial', 'ngComponentRouter', 'ngStorage', 'firebase']);然后在我的控制器里:
var controller = function ($mdDialog) {
...
}
module.component('profile', {
templateUrl: '/Scripts/components/profile/profile.component.html',
controllerAs: 'model',
controller: ['$filter', '$mdDialog', controller],
bindings: {
'$router': '<'
}
});问题是,我尝试使用$mdDialog.alert(...),我得到了以下错误:
TypeError:$mdDialog.alert不是一个函数
$mdDialog对象在那里,但是所有函数都不能工作。我遗漏了什么?有什么想法吗?
发布于 2017-09-21 18:45:55
看起来你给控制器注入了两个服务。这就是您想要的吗?$filter和$mdDialog都需要在Controller函数参数声明中。
https://stackoverflow.com/questions/43119487
复制相似问题