Search This Blog

Q36-Q40

Q36. What do you mean by Vanilla Javascript or VanilaJS?
Q37. Which one comes first? ngOnit or constructor in angular?
Q38. Where there is change in value of input property. which life cycle hook is called? like changing something on component.
Q39. Wha is the use of ngAfterViewInit?
Q40. What is Transpiling and compilation?
-------------------------------------------------------------------------------------------------------------------------
Q36. What do you mean by Vanilla Javascript or VanilaJS?

Answer 36: 

VanillaJS is a name to refer to JavaScript without any additional libraries like jQuery. Vanilla JavaScript refers to the style of coding by making use of core API's or utilities rather than using any helper library or framework to solve a programming problem.
-------------------------------------------------------------------------------------------------------------------------
Q37. Which one comes first? ngOnit or constructor in angular?

Answer 37:

constructor() is the default method in the Component life cycle and is used for dependency injection. Constructor is a Typescript Feature. ngOnInit() is called after the constructor and ngOnInit is called after the first ngOnChanges
-------------------------------------------------------------------------------------------------------------------------
Q38. Where there is change in value of input property. which life cycle hook is called? like changing something on component.

Answer 38:

ngOnChanges()
-------------------------------------------------------------------------------------------------------------------------
Q39. Wha is the use of ngAfterViewInit?

Answer 39:

Angular ngAfterViewInit() is the method of AfterViewInit interface. ngAfterViewInit() is a lifecycle hook that is called after Angular has fully initialized a component's views. ngAfterViewInit() is used to handle any additional initialization tasks.

ngOnInit() is called after ngOnChanges() was called the first time. ngOnChanges() is called every time inputs are updated by change detection.

ngAfterViewInit() is called after the view is initially rendered. This is why @ViewChild() depends on it. 
https://www.concretepage.com/angular/angular-ngafterviewinit
--------------------------------------------------------------------------------------------------------------------------
Q40. What is Transpiling and compilation?

Answer 40:

Transpiling is a process of converting your typescript code into Javascript code using transpilar. 

Transpiling code is a similar concept to the compilation process, with one big difference. Compiling: code from a high level language is get converted to machine level language. Transpiling: code from a high level language gets converted to another high level language
--------------------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment