is possible [execute function] e.g. open modal dialog window routeprovider when route requested?
myapp.config(function($routeprovider) { $routeprovider .when('/home', { controller: 'homectrl', templateurl: 'home/homeview.html' } ).when('/profile/:userid/changepwd', function(){ $dialog.messagebox(title, msg, btns) .open() .then(function(result){ alert('dialog closed result: ' + result); }); } ).otherwise({ redirectto: '/home' }); });
ps: want cancel route , instead open dialog box. opening dialog box not issue. cancelling route major issue.
you can pass function dependency in resolve , wait until dependency resolved , when dialog ends change route , modify history wish using $location
var app = angular.module('myapp', []) .config(['$routeprovider', function($routeprovider) { $routeprovider.when('/view1', { template: ' ', controller: //empty function, resolve: { data1 : function($dialog, $location) { var promise = $dialog.messagebox(title, msg, btns) .open() .then(function(result){ alert('dialog closed result: ' + result); //use [$location][1] change browser history }); return promise; } } }); }]);
Comments
Post a Comment