Site icon SKLEARNING

ANGULAR INTERVIEW QUESTIONS

angularphoto_img

TOP 11 ANGULAR INTERVIEW QUESTIONS

1.What are directives and different types of directives?

Angular Directives are functions that are executed When they are found on the DOM by the Angular compiler

     

2. What is SPA and uses of SPA?

SPA load once and new features are just more additions to the user interface.
New HTML pages are not loaded to display the new page’s content,instead generated dynamically.
A SPA approach is faster ,thus providing a seamless user experience

3.What is Routing?

Routing basically means navigating between pages

 

4.Why do we need lazy loading?

Lazy loading means on demand loading , Loading only the necessary HTML,CSS and JAVASCRIPT files so that you have better performance.

It is used for bigger applications where all the modules are not required at the start of the application

5. Explain Angular life cycle?

6.Difference b/w Constructor vs ngoninit?

 

We mostly use ngOnInit in every startup/announcement and avoid things to work in builders. The constructor should only be used to start class members but should not do the actual “work”.
So you should use the constructor() to set Dependency Injection and not much. ngOnInit() is a better “starting point” – this is where / when component combinations are solved.
We use constructor() for all the initialization/declaration.
It’s better to avoid writing actual work in the constructor.
The constructor() should only be used to initialize class members but shouldn’t do actual “work”.
So we should use constructor() to set up Dependency Injection, Initialization of class fields, etc.
ngOnInit() is a better place to write “actual work code” that we need to execute as soon as the class is instantiated.
Like loading data from Database — to show the user in your HTML template view. Such code should be written in ngOnInit().

7. What are Services?

Angular Services perform tasks that are used by multiple components .
A component can delegate tasks like fetching data from the server,validating user input,or logging directly to the console to the service.
A Service can be written once and injected into all the components that use that service thus avoiding redundat code.

8.what is Dependency Injections and where we use?

Dependency injection is an application design pattern where rather than creating object instances from with in the component ,Angular injects it via the constructor.

Dependency injection helps to decouple class dependencies, so that When you add new dependencies you do not have change everywhere.

The biggest benefit of dependency injection is decoupling.

9.How to make HTTP calls?

10.Explain rxJ?

11.Diffrence b/w Angular JS and Angular

Exit mobile version