javascript - Preserving back button in angular through a loading controller? -


depending on logic in services, route different views. facilitate service injection, use loading controller determine go next.

this works great, except can't go "back" through loading controller. how either detect button, or fix loading model more friendly it?

    .when('/loading', {                 templateurl: '/app/views/mystuff/loading.html',                 controller: 'loadingcontroller'             })  angular.module('app').controller('loadingcontroller', ['$location', 'whereservice',     function ($location, whereservice) {         if (!whereservice.donewitha()) {             $location.path('/a');         }         else if (!whereservice.donewithb()) {             $location.path('/b');         }         else {             location.href = "/myapp/somewhereelseentirely"//this fine         }     }]);  angular.module('app').controller('aloadingcontroller', ['$location', 'aservice',     function ($location, aservice) {         if (!aservice.isdone()) {             $location.path(aservice.currentpath());         }         else {             $location.path('/');//triggers loading controller above         }     }]); 

sounds need $location.replace():

if called, changes $location during current $digest replacing current history record, instead of adding new one.

https://docs.angularjs.org/api/ng/service/$location


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -