Q71. What is change detection strategy in Angular?
Q72. What are the disadvantages of Default Change detection strategy in angular?
Q73. How to call method of un related components from comp1 to component 2?
Q74. What is the root module and root component in your project?
Q75. What is angular expression and how it is different from javascript expression?
-------------------------------------------------------------------------------------------------------------------------------------
Q71. What is change detection strategy in Angular?
Answer:
Change detection strategy as the name states its a strategy which angular uses to detect the change in values in DOM. For example if you are using two way binding and in case something changes on controller it get changed on HTML as well.
We have two detection strategy
1) Default - it is default. it means by default it will always detect change in model, dom or a change in a event etc
2) onPush - We are going to tell when to detect the change.
API of above code is written in Zone.js file
For theory start 4 mins are enough.
-------------------------------------------------------------------------------------------------------------------------------------
Q72. What are the disadvantages of Default Change detection strategy in angular?
Answer:
Default change detection strategy has its disadvantage of low performance. in case we have parent component and its child component, and its child component and the family tree is pretty big. In those scenarios default change detection strategy gives low performance.
In above scenario we use onPush strategy. When ever we want angular to check then only it will check for changes.
For theory start 4 mins are enough.
-------------------------------------------------------------------------------------------------------------------------------------
Q73. How to call method of un related components from comp1 to component 2?
Answer:
Learning Topics #Angular: Component Data Transfer
-------------------------------------------------------------------------------------------------------------------------------------
Q74. What is the root module and root component in your project?
Answer:
by default rootmodule is AppModule defined in app.module.ts. It is defined as rootmodule min main.ts file.
We can have only 1 root module in application but there is a way by which we can bootstrap multiple root modules in 1 go. create one more module and mentioned 2 and more modules into this 1 module and bootstrap this single modules.
By default root component is app.component. it is defined as root component in app.module.ts bootstrap key
-------------------------------------------------------------------------------------------------------------------------------------
Q75. What is angular expression and how it is different from javascript expression?
Answer:
Angular expressions can be written inside double braces: {{ expression }}. or with directive like ngbind="expression".
Javascript expression are like x += y which means x = x + y;
Angular expression are evaluated again angular object and scope while javascript expression can be evaluated against global window.
Angular expression can work with filter but javascript expression can not work with filters.
-------------------------------------------------------------------------------------------------------------------------------------
No comments:
Post a Comment