I have div1
and div2
.
If a user is admin I want him to see both of them.
If a user is a simple user, I want him to see only div2
.
I used ng-if
(beacuse it removes the div
completely, and not using display:none
)
Is it safe? Can it be intercepted and/or changed by proxy tools and/or chrome developer tools.
I didn't find any info on that.
Since all AngularJs code is client side, directives like ng-if
will not protect you from proxy tools that target HTTP.
So, it depends what you mean be safe. If you are providing sensitive information from the server, then no UI pattern/tool will secure that information.
Usually in SPA applications, security is applied to the server API that the client is speaking to. The UI should be treated as under the control of the user.
if i exclude the security discussion/consideration, I would prefer to use ng-show instead. I will introduce relevant modal properties in angularjs controller and show/hide based on them in html page.
Yes, the client side code can be investigated say using chrome developer tool and firebug etc.
I second @Davin Tryon suggestion, and say that Better to secure contents on server side.