Thursday, September 13, 2018

Angular4 : File Upload

Angular4 : Role based Authorization

Angular4 : Role based Authorization 


Step1: get All user Roles from DB and store it in localStorage eg: ['Reader','Writer']

Step2: on UI component put *ngIf=roleMatch(['Admin'])   
=>   roleMatch() {......compare ['Reader','Writer']   with ['Admin']  => If matches return true...}


Angular4 : Angular Life cycle hooks

Angular4 : Angular Life cycle hooks

For more info plz visit:

https://www.youtube.com/watch?v=RCLwwWQ8-V0&t=48s


1. Creates the component
2. Renders the component
3. Creates and renders the component children
4. Checks when the component data-bound properties change, and
5 Destroy the component before removing it from the DOM




1> Constructor call => Before component loads


2> Example of "ngOnChanges" => If value for any of the property is changed.
Below eg has 2 components,  "simple" component is added inside "my-app" component
And if we enter any thing in text box same thing we are passing to another component using [simpleInput]    =>   @Input()   option




3> ngOnInit => after component loads

Like service call (eg:  service.getEmployeeList())  and bind to variable.