javascript - Open Modal and change URL without change the view in AngularJS -
javascript - Open Modal and change URL without change the view in AngularJS -
i'm trying open modal angularjs.
my route task list is:
/client/:id/task/list
its working fine. now, i'm trying show task info in modal, above list.
my route is:
/client/:id/task/:id
how can open modal above list view, alter url, don't alter view?
i saw lot of topics this, none solution.
thanks.
you can specify states want show modal , when handled, homecoming state want to. example;
app.config(function ($stateprovider) { $stateprovider.state('tasks', { url: '/tasks', templateurl: 'tasks.html', controller: 'tasksctrl' }).state("tasks.show", { url: "/tasks/:id", onenter: function($stateparams, $state, $modal) { $modal.open({ templateurl: "show.html", resolve: {}, controller: function($scope, $state) { $scope.ok = function () { $scope.$close(); }; $scope.dismiss = function () { $scope.$dismiss(); }; } }).result.then(function (result) { // $scope.$close }, function (result) { // $scope.$dismiss }).finally(function () { // homecoming $state.transitionto("tasks"); }); } }); });
related plunker here http://plnkr.co/edit/fcyrlh
javascript angularjs angular-ui-router
Comments
Post a Comment