We are back again with our Interview preparation guide. Here is some most asked angular interview questions specially in your round1 for judging your in depth knowledge of Angular . These are few basic question to judge your understanding and crack you the Angular interview in a easy way.
1 . What is Angular ?
Angular is a Type-Script based open-source web application framework, developed and maintained by Google. It offers an easy and powerful way of building front end web-based applications and empowers the front end developers in curating cross-platform applications. It integrates powerful features like declarative templates, an end to end tooling, dependency injection and various other best practices that smoothens the development path.
2. Why Angular ?
The main purpose of using Angular is to create fast, dynamic, and scalable web
applications with ease, using components and directives.
§ Great support by Google, thus making the
platform user-friendly and trustworthy.
§ A component-based architecture where the
application is divided into functional and logical components that are
independent of each other
§ Reusable code and third-party components like
Angular Material are available
§ Rendering is very fast
§ CLI support
§ Excellent doucumentation and Support
§ Open Source
§ Best for SPA (Single Page Application)
3. Essential building
blocks Off Angular
Templates: Templates are written in HTML and contain Angular elements
and attributes. Models provide a dynamic view to the user by combining
information from the controller and view and rendering it.
Directives: Directives allow developers to add new HTML syntax, that
is application-specific.
Services: Rather than calling the Http service, Angular allows for
the creation of new service classes. When new Services are created in Angular,
they can be used by different components.
4. Angular vs Angular-JS
Difference
Angular JS |
Angular |
Based on JavaScript |
Based on TypeScript |
Follows MVC design pattern |
It has components, modules, and
directives |
No support for mobile app |
Support Web and Mobile |
Dependancy Injection support is
not well |
Full Dependancy Injection support |
No SEO Support |
Best SEO Support for available on
every search engine |
Requires specific ng directive for
each of property, event, and image |
For event binding, () is used and
for image or property binding [] is used |
5. What Is Angular CLI?
Angular CLI automates the end-to-end development process. we can create a new
project, add new features, and run tests (unit tests and end-to-end tests) by
just typing a few simple commands. This way, development and testing processes
both become faster.
6. Angular Life Cyle
Life-Cycles includes all the events which occurred from Application start to
application End or destroy .
ngOnChanges( ): This method is
called whenever one or more input properties of the component changes. The hook
receives a SimpleChanges object containing the previous and current values of
the property.
ngOnInit( ): This hook gets
called once, after the ngOnChanges hook.
It initializes the
component and sets the input properties of the component.
ngDoCheck( ): It gets called
after ngOnChanges and ngOnInit and is used to detect and act on changes that
cannot be detected by Angular.
We can implement our
change detection algorithm in this hook.
ngAfterContentInit( ): It gets called
after the first ngDoCheck hook. This hook responds after the content gets
projected inside the component.
ngAfterContentChecked( ): It gets called
after ngAfterContentInit and every subsequent ngDoCheck. It responds after the
projected content is checked.
ngAfterViewInit( ): It responds
after a component’s view, or a child component’s view is initialized.
ngAfterViewChecked( ): It gets called after ngAfterViewInit, and it
responds after the component’s view, or the child component’s view is checked.
ngOnDestroy( ): It gets called just before Angular destroys
the component. This hook can be used to clean up the code and detach event
handlers.
7 . Differance between
ngOnInit and Constructor
Both are not
inter-related with each other . Constructor is a class concept i.e Type-Script
and ngOnInit is a Angular Concept .
ngOnInit |
Constructor |
NgOnInit is Angular Concept or
it’s a Angular life cycle hook method |
Constructor is TypeScript concept |
Called by Angular |
Called by JavaScript Engine |
Invoked by Angular when component is
initialized |
Called by JavaScript Engine |
You can access DOM elements as
well as variables and services in NgOnint event |
Used for initialize variables and
Inject dependencies |
Everything is ready at the time of
invocation |
Component is not yet initialized |
8. How does an Angular
application work?
How application work
means the flow of application. Flow means how the files are called and in which
sequence of files the app gets executed when we are developing it.
Flow of application
Execution In Angular :-
§ Angular.json
§ Main.ts
§ App.Module.ts
§ App.Component.ts
§ Index.html
§ App.Component.html
0 comments:
Post a Comment