How can I implement a custom modal in my code that allows me to perform an action only after the user clicks 'okay'?
var modalInstance = this.$modal.open({
templateUrl: '/app/tests/partials/markTest.html',
controller: ['$scope', '$modalInstance', 'testService', ($scope, $modalInstance, testService: ITestService) => {
$scope.cancel = () => {
$modalInstance.dismiss('cancel');
};
$scope.ok = () => {
testService.markTest()
.then(() => {
abc().then(() => {
$modalInstance.close();
})
});
$scope.tes = testService;
}]
});
I want to achieve similar functionality to the modal on Stack Overflow that prompts users when leaving a page. Any suggestions on how to implement this with my current setup?
Your tips and advice would be greatly appreciated.