我在尝试激活带有角度材质设计的警报对话框。
在我的控制器里,我有:
angular.module('KidHubApp')
.controller('ActivityCtrl', ['$scope','$meteor', '$stateParams', '$mdDialog', '$state', function($scope, $meteor, $stateParams, $state, $mdDialog){..。
$mdDialog.show(
$mdDialog.alert()
.clickOutsideToClose(true)
.title('No timeslot selected.')
.textContent('Please select a date and a timeslot to make a reservation.')
.ok("Got it!")
.targetEvent(ev)
);
}然而,我要进入控制台:
TypeError:$mdDialog.alert不是一个函数
我怎么才能解决这个问题?
发布于 2016-04-05 08:46:34
你的函数不符合注射顺序..。
angular.module('KidHubApp')
.controller('ActivityCtrl', ['$scope','$meteor', '$stateParams', '$mdDialog', '$state', function($scope, $meteor, $stateParams, $state, $mdDialog){应该是
angular.module('KidHubApp')
.controller('ActivityCtrl', ['$scope','$meteor', '$stateParams', '$mdDialog', '$state', function($scope, $meteor, $stateParams, $mdDialog, $state){在您的函数参数中交换$state和$mdDialog,以匹配它们被注入的顺序。
https://stackoverflow.com/questions/36421272
复制相似问题