There are too many methods. It depends on your project scale and system design. If you want to limit interface permissions (such as OAuth2), you can consider the following:
If it is routing permission, then slightly modify the above code and it can also be achieved by judging the session.
If you use ui-router, you may consider adding this sentence to app.js:
You may refer to another article for how to implement the specific Auth class: http://blog.coding.net/blog/techniques-for-authentication-in-angular-j...
There are too many methods. It depends on your project scale and system design. If you want to limit interface permissions (such as OAuth2), you can consider the following:
If it is routing permission, then slightly modify the above code and it can also be achieved by judging the session.
If you use
ui-router
, you may consider adding this sentence to app.js:You may refer to another article for how to implement the specific Auth class:
http://blog.coding.net/blog/techniques-for-authentication-in-angular-j...