I have a requirement to execute a method within $mdDialog. This method is passed from the parent component to my directive.
<get-data action="getData()" ></get-data>
To access the method in my get-data directive.
function customDirective() {
return {
restrict: 'E',
scope: {
action: '&?'
},
templateUrl: "",
controller: function($scope) {
'ngInject';
}
Inside my get-data directive, I'm using $mdDialog.
$scope.submit = function(){
$mdDialog.show({
templateUrl: '',
escapeToClose: true,
clickOutsideToClose: true,
controller: function($scope) {
$scope.performAction = function(){
$scope.action()
}
}
})
}
I am attempting to invoke the getData() method within it, but encountering the error $scope.action() is not a function