The Angular 9 RC is out, what an exciting time to be Angular developer. Ivy is here, Ivy is now the default rendering engine in Angular. Follow along and check latest Angular X Interview Questions and Answers with latest Ivy updates for 2020.
Q. How do you create app shell in Angular?
An App shell is a way to render a portion of your application via a route at build time. This is useful to first paint of your application that appears quickly because the browser can render static HTML and CSS without the need to initialize JavaScript. You can achieve this using Angular CLI which generates an app shell for running server-side of your app.
Q. What the importance of Dirty Flag, pristine, touched, untouched, valid, invalid?
Q. What is the difference between constructor() and ngOnInit()?
TypeScript classes has a default method called constructor()
which is normally used for the initialization purpose. Whereas ngOnInit()
method is specific to Angular, especially used to define Angular bindings. Even though constructor()
getting called first, it is preferred to use ngOnInit()
method for Angular bindings.
Q3: What are pipes? Give me an example. ⭐
Answer:
A pipe takes in data as input and transforms it to a desired output. You can chain pipes together in potentially useful combinations. You can write your own custom pipes. Angular comes with a stock of pipes such as DatePipe
, UpperCasePipe
, LowerCasePipe
, CurrencyPipe
, and PercentPipe
.
Consider:
In this page, youll use pipes to transform a components birthday property into a human-friendly date.
Q. What are the restrictions on declarable classes?
Below classes should not be declared,
Q90: When does a lazy loaded module is loaded? ⭐⭐⭐⭐
See Answer
Q82: How would you insert an embedded view from a prepared TemplateRef? ⭐⭐⭐⭐
See Answer
Q70: Angular 8: Explain Lazy Loading in Angular 8? ⭐⭐⭐
See Answer
Q32: What is difference between “declarations”, “providers” and “import” in NgModule? ⭐⭐⭐
See Answer
Q34: What’s new in Angular 6 and why shall we upgrade to it? ⭐⭐⭐
See Answer
Q96: Do I need to bootstrap custom elements? ⭐⭐⭐⭐
See Answer
Q. What are the class decorators in Angular?
A class decorator is a decorator that appears immediately before a class definition, which declares the class to be of the given type, and provides metadata suitable to the type The following list of decorators comes under class decorators,
Q. How will you put one async call before another?
An async
function can contain an await
expression, that pauses the execution of the async function and waits for the passed Promise
resolution, and then resumes the async
function execution and returns the resolved value. Example:
Q. How to display only month in Angular?
Every application has at least one Angular module, the root module that you bootstrap to launch the application is called as bootstrapping module. It is commonly known as AppModule. The default structure of AppModule generated by AngularCLI would be as follows,
Q. What is the purpose of base href tag?
The routing application should add element to the index.html as the first child in the tag inorder to indicate how to compose navigation URLs. If app folder is the application root then you can set the href value as below
The RouterOutlet is a directive from the router library and it acts as a placeholder that marks the spot in the template where the router should display the components for that outlet. Router outlet is used like a component,