【发布时间】:2019-06-12 22:47:22
【问题描述】:
我需要在 $mdDialog 中调用一个函数。此函数正在从父级传递给我的指令。
<get-list callback="getList()" ></get-list>
在我的 get-list 指令中获取函数。
function directive() {
return {
restrict: 'E',
scope: {
callback: '&?'
},
templateUrl: "",
controller: function($scope) {
'ngInject';
}
现在在我的 get-list 指令中,我有一个 $mdDialog。
$scope.save = function(){
$mdDialog.show({
templateUrl: '',
escapeToClose: true,
clickOutsideToClose: true,
controller: function($scope) {
$scope.teste = function(){
$scope.callback()
}
}
})
}
我需要在其中调用函数 getList(),我得到了错误 $scope.callback() 不是函数
【问题讨论】:
标签: javascript angularjs angular-material