Very very warm welcome from www.questpond.com
this is Shivprasad Koirala and in this podcast series we will be discussing about the most asked Angular interview questions with detailed answers around it.
Angular is a very hot and an up-trending topic with lot of employment opportunities. This podcast series will focus around
what kind of questions are asked in Angular and what is the expected answer by the interviewer.
We have divided the podcast series into 10 minutes each
every podcast will try to cover 5 to 6 questions
and at the end of 10 minutes
we will have a quick revision as well.
We do not recommend these questions for getting jobs
there is no alternative for hard work
we should be hands-on on Angular, understand Angular fundamentals
should have the capabilities to Angular projects.
Incase you are new to Angular visit the website Questpond.com
there we have full 8 hours of Learn Angular step by step series.
The point of this podcast series is for last minute revision.
The goal of this podcast series is you have an interview coming up next morning and to ensure you are ready for it.
Let us get started with the first question of Angular
Q.1 What is the goal or need of Angular?
Lot of candidates answer this question as same it is for Single Page Application(SPA) or some say a JavaScript UI framework and so on.
We would suggest to answer in a more detailed way or more holistic way so that you send a message to interviewer that you really know Angular and you are the right candidate.
Answer something like this
Angular is a JavaScript binding framework which binds the HTML UI and the JavaScript Model.
This helps you to reduce effort on writing those lengthy lines of code for binding.
Adding to it
it also helps to build Single Page Application because it has a concept of routing
It also has lot of other features like HTTP, DI, Input/Output and so on because of which we do not need other frameworks.
When you are answering question
answer in a more detailed way and not just one liners.
Q.2 What is the use of component and module?
As said in the previous question Angular is a binding framework, it binds the UI and Model.
Component is where you right code behind your binding code.
Component binds the UI and the Model and module groups components.
In a big project we will have lot of UI
Components and Models.
We can logically group them by using Modules.
Component binds the UI and Model while module groups the components.
Q.3 Explain SPA or Single Page Application and how do we implement the same in Angular?
SPA stands for Single Page Application
SPA is a application where the main UI gets loaded once and then the needed UI is loaded on demand.
E.g - Ina typical website we have Master Pages
some even term them as templates.
Typical master page has a left menu, top banner, footer and so on.
The master page gets loaded once
and then on demand depending on which link user clicks the other pages are loaded.
The main master page is not loaded again and again. In Angular it is implemented by using the routing concept.
SPA are those applications where the main page is loaded once and the other page which are needed are only needed and not the whole page again and again.
To implement the same in Angular
use something called as
Angular Routing.
Q.4 Explains the importance of Routing in Angular
and how do we implement the same?
Routing helps to define the navigation structure of Angular application.
To move from one screen to screen
then routing is needed.
Routing also helps to implement Single Page Application
that means when we are moving from one screen to other screen
we do not refresh or reload the whole UI.
To implement routing we need to do the following things
first
we need to create routing connection which defines the URL path and which component to be loaded for that url.
Later this routing collection is loaded
using router module using forRoot and forChild.
then we can use router link directive on the html </a tag or in the code behind i.e. in the TS
we can use Router.navigate
When the navigation happens
the whole UI gets loaded
in the router outlet tag.
This router outlet tag is a reserved tag in which the UI loads when routing happens.
Angular routing
defines navigation of project
helps to implement Single Page Application that means
while we navigate from screen to other screen
the whole UI does not get refreshed.
Q.5 What is Lazy Loading concept in Angular?
Lazy loading means
on demand loading.
Loading only the necessary HTML, CSS and JavaScript files
to have better performance.
E.g. We have a hospital management system
so when the front desk user logs in
we just load appointment module
and billing module.
When doctor logs in
it load modules like treatment, operation theater and so on.
With Lazy loading
we have better UI experience and performance
because we load only the necessary html, JS and CSS files
that is needed by the end user.
Q.6 How to implement lazy loading in Angular?
in order to implement lazy loading we need to do three steps
the first is we need to divide project into separate separate modules
so we can load them separately
the second step is we need to create
separate routing files for each module
and use the loadChildren
to
specify the modules which has to be loaded on demand
and the last one is
in the routing navigation when we are loading the routes from the module
we have to use the forRoot to load the routes of the main module
and forChild to load the child module
To implement lazy loading in 3 steps
divide project into separate modules
use the loadchildren
to load the modules lazily and then use the forRoot and forChild
to specify
which is the root module and which are the child modules.
We have completed 6 questions and let us revise each one of them.
What is the goal of Angular?
The goal of Angular is that it is a binding framework , it is a full
UI framework where we have Single Page Application,
a nice build engine, lazy loading and so on.
What is the use of Components and Modules in Angular?
Modules actually helps to do components
and component is where we write all our code behind or binding
it helps to bind UI with Model with Services and so on.
Explain the concept of Single Page Application and how do we implement the same in Angular?
Single Page Application means will load the page
once and then we load only the necessary pages what we want.
and the same we implement in Angular by using Routing.
Explain the importance of routing in Angular and how do we implement the same?
Routing helps to define navigation in Angular it also helps to implement
Single Page Application
and we implement the same by using Angular Routing.
We define routing collection
and then load the routing collection by using forRoot or forChild
then we use router.navigate method
or router/ link to load the
pages into router outlet.
What is Lazy loading concept in Angular?
Lazy loading helps to load only the necessary JS, HTML and CSS files
which end user needs.
we implement lazy loading by using loadChildren
by using forRoot and forChild
and by dividing our projects into small small individual module.
Would like to suggest take down notes on paper or you can download the angular interview questions and answers PDF which is attached in this podcast
if not able to locate it ping us on www.questpond.com
Keep learning
happy job hunting
In the next podcast series will discuss next 10 minutes of the most asked questions in Angular.
Do not forget to visit the site www.questpond.com