Skip to content
Advertisement

How i show/hide a button in angular according to user authorization?

I have tried something like this

JavaScript

And in my javascript

JavaScript

But it return me some errors at $ rootscope

Advertisement

Answer

Better use $http service provided by angular. Set authentication variable as false, call the authentication service from backend and change the value of authentication variable. Binding from Angular will transmit the value to the view and you will be able to use the value in view.

JavaScript

HTML:

JavaScript
Advertisement