Angular - Things you must know.
Question 01. Advantages and disadvantages which you know in angular?
Every interviewer like to ask this question at the very beginning of every interview because it perfectly shows how broad the knowledge candidate does have and how many features in angular he or she uses. You can mention everything you like or don't like in angular and the more the better advantages.
Advantages
Disadvantages
Question 02. What is change detection? What is this and how does it work?
Change detection is a mechanism after the view is rendered in case data was changed it is triggered when one of the next events happened.
When an AJAX call was performed and the last thing when some set interval or set timeout was ticked once it happens angular start traversing the tree of components and this traversing is a quite heavy operation and it can be the cause of their performance issues and on another way of how to optimize it is ng on push strategy by setting up our own push change detection strategy you are telling Angular to perform change detection only in next cases.
it's important to unsubscribes from the stream in case if the component has been destroyed
Question 03. Dependency injection and how it works?
Dependency injection is an application design pattern which has its own implementation in angular and the main idea of this pattern is when a class delegates a creation and providing some external dependencies to some external resource.
There are two types of injectors
Model injector - which can be configured inside ng model and injectable annotations
Element injector - injector which is being created for every DOM element and can be configured inside the component or directive annotation. Inside this directive or component annotation, you have this provider's property to providers array where you provide some services whatever. These two type of injectors they have its own hierarchy
How does angular resolves these dependencies?
When the component declares some dependency angular first of all tries to resolve it in its own element injector of these components which declares this dependency. If there is no provider for it angular asks a parent element injector and then in continues to go up until it is finds it.
if it cannot resolve even in the model injector hierarchy you will get most probably the error (null inject).
Question 04. what is RXJS?
A library that implements the concept of reactive programming and this library is heavily used in the angular application you are not able to avoid using?RXJS in the angular application
so you must understand at least some core concepts of this. The most popular question about this topic is, what the difference between observables and streams compared to promises.
Difference between observables and streams comparing to promises.
It is important to know RXJS operators and you need to really pay attention to operators like SwitchMap(), map(), and contact() are worked and also some combined them in practical use because it is a really bad sign if you don't know how to combine them. Later on, you can see in your code base something like subscribe inside subscribed and subscribed.
It is important to know the subject in RXJS and what kind of subject you know so there are subjects just Subject, BehaviorSubject, ReplaySubject?and AsyncSubject
To prevent memory leaks
Kill every subscription, if you destroy some particular component and async pipe we have to use as much as we can because it cares about unsubscription as well so very handy.