Adding to those already mentioned in these answers, you should keep in mind that when running webapps, the user has access to all of your client code. Thus, you should not even think about hiding sensitive data on the client side.
In addition, you should know a little more about the differences between ng-if
and ng-show
, ng-hide
. Quote from AngularJS website
ngIf differs from ngShow and ngHide in that ngIf completely removes and recreates the element in the DOM, rather than changing its visibility using the css display property. A common case where this difference is significant is the use of css selectors that rely on the position of an element in the DOM, such as the first-child or: last-child pseudo-classes.
Therefore, it is NOT safe to hide sensitive data in the interface. Depending on the user's permission level, you can make a separate API call to retrieve the data. On the server, check the permission and answer the corresponding answer.
source share