I have a main.controller.js where there is a modal in place to notify the user of a warning before proceeding to the rest of the application.
For example, I want to trigger my fileNew function from the modal.
In main.controller.js:
$scope.warningModal = function() {
$modal.open({
animation: true,
templateUrl: "./modal.html",
controller: "modalController",
});
};
$scope.fileNew = function(type, subject, application) {
newApplication(type, subject, application)
$state.go('submissions');
});
};
In main.html:
<li><a ng-click="warningModal()">New app</a></li>
In modal.html:
<div class="modal-body">
<p>Warning message</p>
</div>
<div class="modal-footer clearfix">
<button class="pull-right btn btn-primary" ng-click="$parent.fileNew()">Continue</button>
</div>
In modalController:
$scope.$parent.fileNew();
When executing this, an error is shown in the console indicating that $scope.$parent.fileNew is not a function.
Any suggestions on how to resolve this?
EDIT:
Another query related to this concept...
I have three different types of fileNew applications that need to be filed...
In my main controller.js:
$scope.fileNew = function(type, subject, application) {
newApplication(type, subject, application)
$state.go('submissions');
});
};
$scope.fileOld = function(type, subject, application) {
newApplication(type, subject, application)
$state.go('submissions');
});
};
$scope.fileEdit = function(type, subject, application) {
newApplication(type, subject, application)
$state.go('submissions');
});
};
Is it possible to indicate which application type is being clicked on for the same continue button in the modal?