I have an AngularJS Single Page Application where there are lot of HTML blocks which I show to users based on their permission levels.
The user permission is determined by service calls and a value is set based on permission.
$scope.permission = 'admin'
I can use ng-hide/show directives to hide those blocks based on permission. But I am worried about security. By changing the css display property those who are not authorized can also view those blocks.
The other option is ng-if, which I am using currently. But I would like to know whether I should do the same with routing, which is more secure, I believe. I can use ui.router angular module to acheive this. But what is the right way?
Should I use ng-hide/show, ng-if or routing?
Expecting some good thoughts.
Any help is greatly appreciated. Thanks in advance.