javascript - Angular js - call a route without view -


To delete the session after deleting I try to call / auth / logout url I am:

  app.config (['$ routeProvider', function ($ route provider) {$ routeProvider. When ('/ auth / logout', {controller: 'AuthLogout' // templateUrl : did not need to })}). Controller ('AuthLogout', ['$ window', '$ location', function ($ window, $ location) {$ window.localStorage.removeItem ('user_username'); $ window.localStorage.removeItem ('User_id'); $ Window.localStorage.removeItem ('user_session_token'); $ location.path ('/');}]); I do not really need a view for AuthLogout controller, but if I do not specify  templateUrl  in the passphrase then I can not get it to do this work, while I am a  TemplateUrl . 

How do I call a URL / controller to load without a scene?

You can:

 . When ('/ auth / logout', {controller: function () {//  

BTW may get some code in your code because the template works and you can use it in the same way


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -