javascript - How to refresh resolve? -


using ui-router, have state resolve function:

.state('tab.social', {     url: '/social/',     views: {       'menucontent': {         templateurl: 'templates/social/tab-social.html',         controller: 'socialctrl',         resolve: {           socialauthresolve: socialauthresolve         }       }     }   }) 

i capture resolve in controller follows:

.controller('socialctrl', function($scope, socialauth, socialauthresolve) {     //     console.log(socialauthresolve);      //     $scope.logout = function() {        socialauth.logout();        $state.go('tab.social', {}, {reload: true});     };      //     $scope.login= function() {        socialauth.login();        $state.go('tab.social', {}, {reload: true});     }; }) 

however, when either pressing logout or login, state not refreshed. using parameters resolve socialauthresolve , updated. in case, old parameters still in there.

only when refresh browser, variables , page updated accordingly. how can refresh page after logout , login? instance, force resolve again?

here sample state config:

.state('app.statename', {       url: "/theurl",       views: {         'myviewname': {           templateurl: "templates/template.html",           controller: 'somecontroller',           resolve: {             pleaseresolve: function() {               console.log("i resolved");             }           }         }       }     }) 

in controller (assuming somecontroller mentioned above), whenever enter state run this.

var res = ($state.$current.self.views.myviewname.resolve.pleasereslove) res.call() 

this call resolve function every time come view.


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -