Angular PDF
Angular PDF
No. Questions
3 What is TypeScript?
9 What is a template?
10 What is a module?
13 What is metadata?
16 What is a service
20 What is the option to choose between inline and external template file?
24 What is interpolation?
https://github.com/sudheerj/angular-interview-questions 1/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
No. Questions
40 What is RxJS?
41 What is subscribing?
42 What is an observable?
43 What is an observer?
45 What is multicasting?
57 What are the mapping rules between Angular component and custom element?
https://github.com/sudheerj/angular-interview-questions 2/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
No. Questions
77 What is JIT?
78 What is AOT?
87 What is folding?
98 What is zone?
110 What are the differences between AngularJS and Angular with respect to dependency injection?
https://github.com/sudheerj/angular-interview-questions 3/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
No. Questions
https://github.com/sudheerj/angular-interview-questions 4/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
No. Questions
163 What is the role of template compiler for prevention of XSS attacks?
171 How do you support server side XSS protection in Angular application?
https://github.com/sudheerj/angular-interview-questions 5/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
No. Questions
⬆ Back to Top
AngularJS Angular
This uses use JavaScript to build the application Introduced the typescript to write the application
Difficulty in SEO friendly application development Ease to create SEO friendly applications
⬆ Back to Top
3. What is TypeScript?
TypeScript is a typed superset of JavaScript created by Microsoft that adds optional types, classes, async/await, and
many other features, and compiles to plain JavaScript. Angular built entirely in TypeScript and used as a primary
language. You can install it globally as
document.body.innerHTML = greeter(user);
⬆ Back to Top
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 7/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
ii. Modules: An angular module is set of angular basic building blocks like component, directives, services etc. An
application is divided into logical pieces and each piece of code is called as "module" which perform a single task.
iii. Templates: This represent the views of an Angular application.
iv. Services: It is used to create components which can be shared across the entire application.
v. Metadata: This can be used to add more data to an Angular class.
⬆ Back to Top
Now this directive extends HTML element behavior with a yellow background as below
⬆ Back to Top
@Component ({
selector: 'my-app',
template: ` <div>
<h1>{{title}}</h1>
<div>Learn Angular6 with examples</div>
</div> `,
})
⬆ Back to Top
Component Directive
To register a component we use @Component meta-data To register directives we use @Directive meta-data
annotation annotation
https://github.com/sudheerj/angular-interview-questions 8/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
Component Directive
Only one component can be present per DOM element Many directives can be used per DOM element
⬆ Back to Top
9. What is a template?
A template is a HTML view where you can display data by binding controls to properties of an Angular component. You
can store your component's template in one of two places. You can define it inline using the template property, or you
can define the template in a separate HTML file and link to it in the component metadata using the @Component
decorator's templateUrl property. Using inline template with template syntax,
@Component ({
selector: 'my-app',
template: '
<div>
<h1>{{title}}</h1>
<div>Learn Angular</div>
</div>
'
})
@Component ({
selector: 'my-app',
templateUrl: 'app/app.component.html'
})
⬆ Back to Top
@NgModule ({
imports: [ BrowserModule ],
https://github.com/sudheerj/angular-interview-questions 9/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
i. The imports option is used to import other dependent modules. The BrowserModule is required by default for any
web based angular application
ii. The declarations option is used to define components in the respective module
iii. The bootstrap option tells Angular which Component to bootstrap in the application
⬆ Back to Top
i. ngOnChanges: When the value of a data bound property changes, then this method is called.
ii. ngOnInit: This is called whenever the initialization of the directive/component after Angular first displays the data-
bound properties happens.
iii. ngDoCheck: This is for the detection and to act on changes that Angular can't or won't detect on its own.
iv. ngAfterContentInit: This is called in response after Angular projects external content into the component's view.
v. ngAfterContentChecked: This is called in response after Angular checks the content projected into the
component.
vi. ngAfterViewInit: This is called in response after Angular initializes the component's views and child views.
vii. ngAfterViewChecked: This is called in response after Angular checks the component's views and child views.
viii. ngOnDestroy: This is the cleanup phase just before Angular destroys the directive/component.
⬆ Back to Top
Property binding: [property]=”value”: The value is passed from the component to the specified property or simple
HTML attribute
https://github.com/sudheerj/angular-interview-questions 10/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
ii. From the DOM to the Component: Event binding: (event)=”function”: When a specific DOM event happens (eg.:
click, change, keyup), call the specified method in the component
<button (click)="logout()"></button>
iii. Two-way binding: Two-way data binding: [(ngModel)]=”value”: Two-way data binding allows to have the data
flow both ways. For example, in the below code snippet, both the email DOM input and component email property
are in sync
⬆ Back to Top
@Component({
selector: 'my-component',
template: '<div>Class decorator</div>',
})
export class MyComponent {
constructor() {
console.log('Hey I am a component!');
}
}
@NgModule({
imports: [],
declarations: [],
})
export class MyModule {
constructor() {
console.log('Hey I am a module!');
}
}
ii. Property decorators Used for properties inside classes, e.g. @Input and @Output
@Component({
selector: 'my-component',
template: '<div>Property decorator</div>'
})
@Component({
selector: 'my-component',
template: '<div>Method decorator</div>'
})
export class MyComponent {
https://github.com/sudheerj/angular-interview-questions 11/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
@HostListener('click', ['$event'])
onHostClick(event: Event) {
// clicked, `event` available
}
}
iv. Parameter decorators Used for parameters inside class constructors, e.g. @Inject
@Component({
selector: 'my-component',
template: '<div>Parameter decorator</div>'
})
export class MyComponent {
constructor(@Inject(MyService) myService) {
console.log(myService); // MyService
}
}
⬆ Back to Top
Below are the list of few commands, which will come handy while creating angular projects
i. Creating New Project: ng new
ii. Generating Components, Directives & Services: ng generate/g The different types of commands would be,
ng generate class my-new-class: add a class to your application
ng generate component my-new-component: add a component to your application
ng generate directive my-new-directive: add a directive to your application
ng generate enum my-new-enum: add an enum to your application
ng generate module my-new-module: add a module to your application
ng generate pipe my-new-pipe: add a pipe to your application
ng generate service my-new-service: add a service to your application
iii. Running the Project: ng serve
⬆ Back to Top
ngOnInit(){
//called after the constructor and called after the first ngOnChanges()
}
}
https://github.com/sudheerj/angular-interview-questions 12/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
⬆ Back to Top
fetchAll(){
return this.http.get('https://api.github.com/repositories');
}
}
⬆ Back to Top
⬆ Back to Top
@Component({
selector: 'async-observable-pipe',
template: `<div><code>observable|async</code>:
Time: {{ time | async }}</div>`
})
export class AsyncObservablePipeComponent {
time = new Observable(observer =>
setInterval(() => observer.next(new Date().toString()), 2000)
);
}
⬆ Back to Top
20. What is the option to choose between inline and external template file?
https://github.com/sudheerj/angular-interview-questions 13/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
You can store your component's template in one of two places. You can define it inline using the template property, or
you can define the template in a separate HTML file and link to it in the component metadata using
the @Componentdecorator's templateUrl property. The choice between inline and separate HTML is a matter of taste,
circumstances, and organization policy. But normally we use inline template for small portion of code and external
template file for bigger views. By default, the Angular CLI generates components with a template file. But you can
override that with the below command,
⬆ Back to Top
The user variable in the ngFor double-quoted instruction is a template input variable
⬆ Back to Top
<p *ngIf="user.age > 18">You are not eligible for student pass!</p>
Note: Angular isn't showing and hiding the message. It is adding and removing the paragraph element from the DOM.
That improves performance, especially in the larger projects with many data bindings.
⬆ Back to Top
⬆ Back to Top
<h3>
{{title}}
https://github.com/sudheerj/angular-interview-questions 14/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
<img src="{{url}}" style="height:30px">
</h3>
In the example above, Angular evaluates the title and url properties and fills in the blanks, first displaying a bold
application title and then a URL.
⬆ Back to Top
⬆ Back to Top
In the above expression, editProfile is a template statement. The below JavaScript syntax expressions are not allowed.
i. new
ii. increment and decrement operators, ++ and --
iii. operator assignment, such as += and -=
iv. the bitwise operators | and &
v. the template expression operators
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 15/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
From view-to-
1. (target)="statement" 2. on-target="statement" Event
source(One-way)
⬆ Back to Top
@Component({
selector: 'app-birthday',
template: `<p>Birthday is {{ birthday | date }}</p>`
})
export class BirthdayComponent {
birthday = new Date(1987, 6, 18); // June 18, 1987
}
⬆ Back to Top
@Component({
selector: 'app-birthday',
template: `<p>Birthday is {{ birthday | date:'dd/MM/yyyy'}}</p>` // 18/06/1987
})
export class BirthdayComponent {
birthday = new Date(1987, 6, 18);
}
Note: The parameter value can be any valid template expression, such as a string literal or a component property.
⬆ Back to Top
@Component({
selector: 'app-birthday',
template: `<p>Birthday is {{ birthday | date:'fullDate' | uppercase}} </p>` // THURSDAY, JUNE 18, 19
})
export class BirthdayComponent {
birthday = new Date(1987, 6, 18);
}
https://github.com/sudheerj/angular-interview-questions 16/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
⬆ Back to Top
@Pipe({name: 'myCustomPipe'})
ii. The pipe class implements the PipeTransform interface's transform method that accepts an input value followed
by optional parameters and returns the transformed value. The structure of pipeTransform would be as below,
interface PipeTransform {
transform(value: any, ...args: any[]): any
}
iii. The @Pipe decorator allows you to define the pipe name that you'll use within template expressions. It must be a
valid JavaScript identifier.
⬆ Back to Top
@Pipe({name: 'customFileSizePipe'})
export class FileSizePipe implements PipeTransform {
transform(size: number, extension: string = 'MB'): string {
return (size / (1024 * 1024)).toFixed(2) + extension;
}
}
Now you can use the above pipe in template expression as below,
template: `
<h2>Find the size of a file</h2>
<p>Size: {{288966 | customFileSizePipe: 'GB'}}</p>
`
⬆ Back to Top
⬆ Back to Top
/* JavaScript imports */
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 18/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
imports: [
BrowserModule,
// import HttpClientModule after BrowserModule.
HttpClientModule,
],
......
})
export class AppModule {}
ii. Inject the HttpClient into the application: Let's create a userProfileService(userprofile.service.ts) as an example. It
also defines get method of HttpClient
@Injectable()
export class UserProfileService {
constructor(private http: HttpClient) { }
getUserProfile() {
return this.http.get(this.userProfileUrl);
}
}
iii. Create a component for subscribing service: Let's create a component called
UserProfileComponent(userprofile.component.ts) which inject UserProfileService and invokes the service method,
fetchUserProfile() {
this.userProfileService.getUserProfile()
.subscribe((data: User) => this.user = {
id: data['userId'],
name: data['firstName'],
city: data['city']
});
}
Since the above service method returns an Observable which needs to be subscribed in the component.
⬆ Back to Top
getUserResponse(): Observable<HttpResponse<User>> {
return this.http.get<User>(
this.userUrl, { observe: 'response' });
}
Now HttpClient.get() method returns an Observable of typed HttpResponse rather than just the JSON data.
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 19/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
fetchUser() {
this.userService.getProfile()
.subscribe(
(data: User) => this.userProfile = { ...data }, // success path
error => this.error = error // error path
);
}
It is always a good idea to give the user some meaningful feedback instead of displaying the raw error object returned
from HttpClient.
⬆ Back to Top
⬆ Back to Top
// Execute with the observer object and Prints out each item
source.subscribe(myObserver);
// => Observer got a next value: 1
// => Observer got a next value: 2
// => Observer got a next value: 3
// => Observer got a next value: 4
// => Observer got a next value: 5
// => Observer got a complete notification
⬆ Back to Top
⬆ Back to Top
interface Observer<T> {
closed?: boolean;
next: (value: T) => void;
error: (err: any) => void;
complete: () => void;
}
A handler that implements the Observer interface for receiving observable notifications will be passed as a parameter
for observable as below,
myObservable.subscribe(myObserver);
Note: If you don't supply a handler for a notification type, the observer ignores notifications of that type.
⬆ Back to Top
Observable Promise
Declarative: Computation does not start until subscription so that they can be run Execute immediately on
whenever you need the result creation
Subscribe method is used for error handling which makes centralized and predictable error Push errors to the child
handling promises
Provides chaining and subscription to handle complex applications Uses only .then() clause
⬆ Back to Top
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 21/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
myObservable.subscribe({
next(num) { console.log('Next num: ' + num)},
error(err) { console.log('Received an errror: ' + err)}
});
⬆ Back to Top
myObservable.subscribe(
x => console.log('Observer got a next value: ' + x),
err => console.error('Observer got an error: ' + err),
() => console.log('Observer got a complete notification')
);
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
50. What will happen if you do not supply handler for observer?
Normally an observer object can define any combination of next, error and complete notification type handlers. If you
don't supply a handler for a notification type, the observer just ignores notifications of that type.
⬆ Back to Top
⬆ Back to Top
Natively supported from 63 version onwards. You need to enable dom.webcomponents.enabled and
Firefox
dom.webcomponents.customelements.enabled in older browsers
⬆ Back to Top
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 23/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
No, custom elements bootstrap (or start) automatically when they are added to the DOM, and are automatically
destroyed when removed from the DOM. Once a custom element is added to the DOM for any page, it looks and
behaves like any other HTML element, and does not require any special knowledge of Angular.
⬆ Back to Top
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 24/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
⬆ Back to Top
57. What are the mapping rules between Angular component and custom element?
The Component properties and logic maps directly into HTML attributes and the browser's event system. Let us
describe them in two steps,
i. The createCustomElement() API parses the component input properties with corresponding attributes for the
custom element. For example, component @Input('myInputProp') converted as custom element attribute my-
input-prop .
ii. The Component outputs are dispatched as HTML Custom Events, with the name of the custom event matching the
output name. For example, component @Output() valueChanged = new EventEmitter() converted as custom
element with dispatch event as "valueChanged".
⬆ Back to Top
@Component(...)
class MyContainer {
@Input() message: string;
}
After applying types typescript validates input value and their types,
⬆ Back to Top
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 25/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
⬆ Back to Top
⬆ Back to Top
@Directive({
selector: '[appHighlight]'
})
export class HighlightDirective {
constructor(el: ElementRef) {
el.nativeElement.style.backgroundColor = 'red';
}
}
ii. Apply the attribute directive as an attribute to the host element(for example,
iii. Run the application to see the highlight behavior on paragraph element
ng serve
⬆ Back to Top
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 26/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
<base href="/">
⬆ Back to Top
⬆ Back to Top
<router-outlet></router-outlet>
<!-- Routed components go here -->
⬆ Back to Top
<h1>Angular Router</h1>
<nav>
<a routerLink="/todosList" >List of todos</a>
<a routerLink="/completed" >Completed todos</a>
</nav>
<router-outlet></router-outlet>
⬆ Back to Top
<h1>Angular Router</h1>
<nav>
<a routerLink="/todosList" routerLinkActive="active">List of todos</a>
<a routerLink="/completed" routerLinkActive="active">Completed todos</a>
</nav>
<router-outlet></router-outlet>
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 27/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
@Component({templateUrl:'template.html'})
class MyComponent {
constructor(router: Router) {
const state: RouterState = router.routerState;
const root: ActivatedRoute = state.root;
const child = root.firstChild;
const id: Observable<string> = child.params.map(p => p.id);
//...
}
}
⬆ Back to Top
⬆ Back to Top
@Component({...})
class MyComponent {
constructor(route: ActivatedRoute) {
const id: Observable<string> = route.params.pipe(map(p => p.id));
const url: Observable<string> = route.url.pipe(map(segments => segments.join('')));
// route.data includes both `data` and `resolve`
const user = route.data.pipe(map(d => d.user));
}
}
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 28/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
@NgModule({
imports: [
RouterModule.forRoot(
appRoutes,
{ enableTracing: true } // <-- debugging purposes only
)
// other imports here
],
...
})
export class AppModule { }
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 29/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
ng build
ng serve
⬆ Back to Top
ng build --aot
ng serve --aot
Note: The ng build command with the --prod meta-flag ( ng build --prod ) compiles with AOT by default.
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 30/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
⬆ Back to Top
⬆ Back to Top
@Component({
providers: [{
provide: MyService, useFactory: () => getService()
}]
})
function getService(){
return new MyService();
}
@Component({
providers: [{
provide: MyService, useFactory: getService
}]
})
If you still use arrow function, it generates an error node in place of the function. When the compiler later interprets
this node, it reports an error to turn the arrow function into an exported function. Note: From Angular5 onwards, the
compiler automatically performs this rewriting while emitting the .js file.
⬆ Back to Top
⬆ Back to Top
86. Can I use any javascript feature for expression syntax in AOT?
No, the AOT collector understands a subset of (or limited) JavaScript features. If an expression uses unsupported
syntax, the collector writes an error node to the .metadata.json file. Later point of time, the compiler reports an error if
it needs that piece of metadata to generate the application code.
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 31/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
The compiler can only resolve references to exported symbols in the metadata. Where as some of the non-exported
members are folded while generating the code. i.e Folding is a process in which the collector evaluate an expression
during collection and record the result in the .metadata.json instead of the original expression. For example, the
compiler couldn't refer selector reference because it is not exported
@Component({
selector: 'app-root'
})
Remember that the compiler can’t fold everything. For example, spread operator on arrays, objects created using new
keywords and function calls.
⬆ Back to Top
@NgModule({
declarations: wrapInArray(TypicalComponent)
})
export class TypicalModule {}
@NgModule({
declarations: [TypicalComponent]
})
export class TypicalModule {}
⬆ Back to Top
ii. ** Reference to a local (non-exported) symbol:** The compiler encountered a referenced to a locally defined
symbol that either wasn't exported or wasn't initialized. Let's take example of this error,
// ERROR
let username: string; // neither exported nor initialized
https://github.com/sudheerj/angular-interview-questions 32/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
@Component({
selector: 'my-component',
template: ... ,
providers: [
{ provide: User, useValue: username }
]
})
export class MyComponent {}
iii. Function calls are not supported: The compiler does not currently support function expressions or lambda
functions. For example, you cannot set a provider's useFactory to an anonymous function or arrow function as
below.
providers: [
{ provide: MyStrategy, useFactory: function() { ... } },
{ provide: OtherStrategy, useFactory: () => { ... } }
]
iv. Destructured variable or constant not supported: The compiler does not support references to variables assigned
by destructuring. For example, you cannot write something like this:
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 33/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
⬆ Back to Top
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"experimentalDecorators": true,
...
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"preserveWhitespaces": true,
...
}
}
⬆ Back to Top
{
"compilerOptions": {
"experimentalDecorators": true,
...
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"preserveWhitespaces": true,
...
}
}
⬆ Back to Top
@Component({
selector: 'my-component',
template: '{{user.contacts.email}}'
})
class MyComponent {
user?: User;
}
my.component.ts.MyComponent.html(1,1): : Property 'contacts' does not exist on type 'User'. Did you mean 'conta
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 34/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
template: '{{$any(user).contacts.email}}'
The $any() cast function also works with this to allow access to undeclared members of the component.
template: '{{$any(this).contacts.email}}'
⬆ Back to Top
@Component({
selector: 'my-component',
template: '<span *ngIf="user"> {{user.name}} contacted through {{contact!.email}} </span>'
})
class MyComponent {
user?: User;
contact?: Contact;
⬆ Back to Top
@Component({
selector: 'my-component',
template: '<span *ngIf="user"> {{user.contact.email}} </span>'
})
class MyComponent {
user?: User;
}
⬆ Back to Top
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 35/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
A Zone is an execution context that persists across async tasks. Angular relies on zone.js to run Angular's change
detection processes when native JavaScript operations raise events
⬆ Back to Top
⬆ Back to Top
ng new codelyzer
ng lint
⬆ Back to Top
⬆ Back to Top
i. Enabling the animations module: Import BrowserAnimationsModule to add animation capabilities into your
Angular root application module(for example, src/app/app.module.ts).
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule
],
declarations: [ ],
bootstrap: [ ]
})
export class AppModule { }
ii. Importing animation functions into component files: Import required animation functions from
@angular/animations in component files(for example, src/app/app.component.ts).
import {
trigger,
state,
style,
animate,
transition,
// ...
} from '@angular/animations';
https://github.com/sudheerj/angular-interview-questions 36/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
iii. Adding the animation metadata property: add a metadata property called animations: within the @Component()
decorator in component files(for example, src/app/app.component.ts)
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.css'],
animations: [
// animation triggers go here
]
})
⬆ Back to Top
state('open', style({
height: '300px',
opacity: 0.5,
backgroundColor: 'blue'
})),
⬆ Back to Top
state('close', style({
height: '100px',
opacity: 0.8,
backgroundColor: 'green'
})),
⬆ Back to Top
@Component({
selector: 'app-animate',
templateUrl: `<div [@changeState]="currentState" class="myblock mx-auto"></div>`,
styleUrls: `.myblock {
background-color: green;
width: 300px;
height: 250px;
border-radius: 5px;
margin: 5rem;
}`,
animations: [
trigger('changeState', [
https://github.com/sudheerj/angular-interview-questions 37/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
state('state1', style({
backgroundColor: 'green',
transform: 'scale(1)'
})),
state('state2', style({
backgroundColor: 'red',
transform: 'scale(1.5)'
})),
transition('*=>state1', animate('300ms')),
transition('*=>state2', animate('2000ms'))
])
]
})
export class AnimateComponent implements OnInit {
@Input() currentState;
constructor() { }
ngOnInit() {
}
}
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 38/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
user experience of using an application over a slow or unreliable network connection, while also minimizing the risks of
serving outdated content.
⬆ Back to Top
⬆ Back to Top
110. What are the differences between AngularJS and Angular with respect to dependency
injection?
Dependency injection is a common component in both AngularJS and Angular, but there are some key differences
between the two frameworks in how it actually works. | AngularJS | Angular | |---- | --------- | Dependency injection
tokens are always strings | Tokens can have different types. They are often classes and sometimes can be strings. | |
There is exactly one injector even though it is a multi-module applications | There is a tree hierarchy of injectors, with a
root injector and an additional injector for each component. |
⬆ Back to Top
i. You can enable ivy in a new project by using the --enable-ivy flag with the ng new command
ii. You can add it to an existing project by adding enableIvy option in the angularCompilerOptions in your
project's tsconfig.app.json .
{
"compilerOptions": { ... },
"angularCompilerOptions": {
"enableIvy": true
}
}
⬆ Back to Top
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 39/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
Yes, it is a recommended configuration. Also, AOT compilation with Ivy is faster. So you need set the default build
options(with in angular.json) for your project to always use AOT compilation.
{
"projects": {
"my-project": {
"architect": {
"build": {
"options": {
...
"aot": true,
}
}
}
}
}
}
⬆ Back to Top
⬆ Back to Top
After that add the following to the "compilerOptions" section of your project's tsconfig.json
"plugins": [
{"name": "@angular/language-service"}
]
Note: The completion and diagnostic services works for .ts files only. You need to use custom plugins for supporting
HTML files.
⬆ Back to Top
⬆ Back to Top
i. Autocompletion: Autocompletion can speed up your development time by providing you with contextual
possibilities and hints as you type with in an interpolation and elements.
https://github.com/sudheerj/angular-interview-questions 40/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
ii. Error checking: It can also warn you of mistakes in your code.
iii. Navigation: Navigation allows you to hover a component, directive, module and then click and press F12 to go
directly to its definition.
⬆ Back to Top
iii. The component app.component.ts file updated with web worker file
Note: You may need to refactor your initial scaffolding web worker code for sending messages to and from.
⬆ Back to Top
environments.
ii. Running Angular in web worker using @angular/platform-webworker is not yet supported in Angular CLI.
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
iv. @Injectable()
v. @NgModule()
⬆ Back to Top
@Input() myProperty;
@Output() myEvent = new EventEmitter();
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 43/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
An RxJS Subject is a special type of Observable that allows values to be multicasted to many Observers. While plain
Observables are unicast (each subscribed Observer owns an independent execution of the Observable), Subjects are
multicast.
A Subject is like an Observable, but can multicast to many Observers. Subjects are like EventEmitters: they maintain a
registry of many listeners.
subject.subscribe({
next: (v) => console.log(`observerA: ${v}`)
});
subject.subscribe({
next: (v) => console.log(`observerB: ${v}`)
});
subject.next(1);
subject.next(2);
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
ng add @angular/bazel
ii. Use in a new application: Install the package and create the application with collection option
When you use ng build and ng serve commands, Bazel is used behind the scenes and outputs the results in dist/bin
folder.
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 44/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
bazel build [targets] // Compile the default output artifacts of the given targets.
bazel test [targets] // Run the tests with *_test targets found in the pattern.
bazel run [target]: Compile the program represented by target and then run it.
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
<input #uname>
and define view child directive and access it in ngAfterViewInit lifecycle hook
@ViewChild('uname') input;
ngAfterViewInit() {
console.log(this.input.nativeElement.value);
}
⬆ Back to Top
@Component({
selector: 'app-root',
template: `<router-outlet></router-outlet>`
})
export class AppComponent {
https://github.com/sudheerj/angular-interview-questions 45/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
⬆ Back to Top
(or)
let headers = new HttpHeaders().set('header1', headerValue1); // create header object
headers = headers.append('header2', headerValue2); // add a new header, creating a new object
headers = headers.append('header3', headerValue3); // add another header
⬆ Back to Top
i. The first build contains ES2015 syntax which takes the advantage of built-in support in modern browsers, ships less
polyfills, and results in a smaller bundle size.
ii. The second build contains old ES5 syntax to support older browsers with all necessary polyfills. But this results in a
larger bundle size.
Note: This strategy is used to support multiple browsers but it only load the code that the browser needs.
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 46/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
This problem is resolved by using dynamic imports and IDEs are able to find it during compile time itself.
⬆ Back to Top
⬆ Back to Top
buildTarget.options.optimization = true;
https://github.com/sudheerj/angular-interview-questions 47/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
addBuildTargetOption();
⬆ Back to Top
⬆ Back to Top
It supports the most recent two versions of all major browsers. The latest version of Angular material is 8.1.1
⬆ Back to Top
@NgModule({
imports: [
// Other NgModule imports...
LocationUpgradeModule.config()
]
})
export class AppModule {}
⬆ Back to Top
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 48/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
Angular CLI downloads and install everything needed with the Jasmine Test framework. You just need to run ng
test to see the test results. By default this command builds the app in watch mode, and launches the Karma test
runner . The output of test results would be as below,
Note: A chrome browser also opens and displays the test output in the "Jasmine HTML Reporter".
⬆ Back to Top
i. Mandatory polyfills: These are installed automatically when you create your project with ng new command and
the respective import statements enabled in 'src/polyfills.ts' file.
ii. Optional polyfills: You need to install its npm package and then create import statement in 'src/polyfills.ts' file. For
example, first you need to install below npm package for adding web animations (optional) polyfill.
import 'web-animations-js';
⬆ Back to Top
i. ApplicationRef.tick(): Invoke this method to explicitly process change detection and its side-effects. It check the full
component tree.
ii. NgZone.run(callback): It evaluate the callback function inside the Angular zone.
iii. ChangeDetectorRef.detectChanges(): It detects only the components and it's children.
⬆ Back to Top
i. Angular 1 • Angular 1 (AngularJS) is the first angular framework released in the year 2010. • AngularJS is not built
for mobile devices. • It is based on controllers with MVC architecture.
ii. Angular 2 • Angular 2 was released in the year 2016. Angular 2 is a complete rewrite of Angular1 version. • The
performance issues that Angular 1 version had has been addressed in Angular 2 version. • Angular 2 is built from
scratch for mobile devices unlike Angular 1 version. • Angular 2 is components based.
iii. Angular 3 The following are the different package versions in Angular 2. • @angular/core v2.3.0 •
@angular/compiler v2.3.0 • @angular/http v2.3.0 • @angular/router v3.3.0 The router package is already versioned
3 so to avoid confusion switched to Angular 4 version and skipped 3 version.
iv. Angular 4 • The compiler generated code file size in AOT mode is very much reduced. • With Angular 4 the
production bundles size is reduced by hundreds of KB’s. • Animation features are removed from angular/core and
https://github.com/sudheerj/angular-interview-questions 49/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
ng v
ng version
ng -v
ng --version
⬆ Back to Top
Browser Version
Chrome latest
Firefox latest
IE Mobile 11
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
163. What is the role of template compiler for prevention of XSS attacks?
https://github.com/sudheerj/angular-interview-questions 51/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
The offline template compiler prevents vulnerabilities caused by template injection, and greatly improves application
performance. So it is recommended to use offline template compiler in production deployments without dynamically
generating any template.
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
<div [innerHTML]="htmlSnippet"></div>
Unfortunately this property could cause Cross Site Scripting (XSS) security bugs when improperly handled.
⬆ Back to Top
<p>Interpolated value:</p>
<div >{{htmlSnippet}}</div>
<p>Binding of innerHTML:</p>
<div [innerHTML]="htmlSnippet"></div>
https://github.com/sudheerj/angular-interview-questions 52/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
Even though innerHTML binding create a chance of XSS attack, Angular recognizes the value as unsafe and
automatically sanitizes it. ⬆ Back to Top
i. bypassSecurityTrustHtml
ii. bypassSecurityTrustScript
iii. bypassSecurityTrustStyle
iv. bypassSecurityTrustUrl
v. bypassSecurityTrustResourceUrl
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
171. How do you support server side XSS protection in Angular application?
The server-side XSS protection is supported in an angular application by using a templating language that
automatically escapes values to prevent XSS vulnerabilities on the server. But don't use a templating language to
generate Angular templates on the server side which creates a high risk of introducing template-injection
vulnerabilities.
⬆ Back to Top
ii. HttpClient library recognizes the convention of prefixed JSON responses(which non-executable js code with
")]}',\n" characters) and automatically strips the string ")]}',\n" from all responses before further parsing
⬆ Back to Top
interface HttpInterceptor {
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>
}
You can use interceptors by declaring a service class that implements the intercept() method of the HttpInterceptor
interface.
@Injectable()
export class MyInterceptor implements HttpInterceptor {
constructor() {}
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
...
}
}
@NgModule({
...
providers: [
{
provide: HTTP_INTERCEPTORS,
useClass: MyInterceptor,
multi: true
}
]
...
})
export class AppModule {}
⬆ Back to Top
i. Authentication
ii. Logging
iii. Caching
iv. Fake backend
v. URL transformation
vi. Modifying headers
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 54/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
providers: [
{ provide: HTTP_INTERCEPTORS, useClass: MyFirstInterceptor, multi: true },
{ provide: HTTP_INTERCEPTORS, useClass: MySecondInterceptor, multi: true }
],
The interceptors will be called in the order in which they were provided. i.e, MyFirstInterceptor will be called first in the
above interceptors configuration. ⬆ Back to Top
@Injectable()
export class MyInterceptor implements HttpInterceptor {
intercept(
req: HttpRequest<any>,
next: HttpHandler
): Observable<HttpEvent<any>> {
}
}
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, HttpClientModule],
providers: [
{ provide: HTTP_INTERCEPTORS, useClass: MyInterceptor, multi: true }
],
bootstrap: [AppComponent]
})
export class AppModule {}
⬆ Back to Top
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 55/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
For example, let us import German locale and register it in the application
registerLocaleData(localeDe, 'de');
⬆ Back to Top
i. Mark static text messages in your component templates for translation: You can place i18n on every element tag
whose fixed text is to be translated. For example, you need i18n attribue for heading as below,
ii. Create a translation file: Use the Angular CLI xi18n command to extract the marked text into an industry-standard
translation source file. i.e, Open terminal window at the root of the app project and run the CLI command xi18n.
ng xi18n
The above command creates a file named messages.xlf in your project's root directory. Note: You can supply
command options to change the format, the name, the location, and the source locale of the extracted file.
iii. Edit the generated translation file: Translate the extracted text into the target language. In this step, create a
localization folder (such as locale )under root directory(src) and then create target language translation file by
copying and renaming the default messages.xlf file. You need to copy source text node and provide the translation
under target tag. For example, create the translation file(messages.de.xlf) for German language
iv. Merge the completed translation file into the app: You need to use Angular CLI build command to compile the
app, choosing a locale-specific configuration, or specifying the following command options. 1. --i18nFile=path to
the translation file 2. --i18nFormat=format of the translation file 3. --i18nLocale= locale id
⬆ Back to Top
⬆ Back to Top
You can avoid this manual update of id attribute by specifying a custom id in the i18n attribute by using the prefix
@@.
⬆ Back to Top
and the translation unit generated for first text in for German language as
Since custom id is the same, both of the elements in the translation contain the same text as below
<h2>Guten Morgen</h2>
<h2>Guten Morgen</h2>
⬆ Back to Top
Remember that <ng-container> is transformed into an html comment ⬆ Back to Top
By the way, you can also assign meaning, description and id with the i18n-x="|@@" syntax.
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 57/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
⬆ Back to Top
<span i18n>The person is {residenceStatus, select, citizen {citizen} permanent resident {permanentResident} for
⬆ Back to Top
i. Error: It throws an error. If you are using AOT compilation, the build will fail. But if you are using JIT compilation,
the app will fail to load.
ii. Warning (default): It shows a 'Missing translation' warning in the console or shell.
iii. Ignore: It doesn't do anything. If you use AOT compiler then you need to perform changes
in configurations section of your Angular CLI configuration file, angular.json.
"configurations": {
...
"de": {
...
"i18nMissingTranslation": "error"
}
}
If you use the JIT compiler, specify the warning level in the compiler config at bootstrap by adding the
'MissingTranslationStrategy' property as below,
platformBrowserDynamic().bootstrapModule(AppModule, {
missingTranslation: MissingTranslationStrategy.Error,
providers: [
// ...
]
});
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 58/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
"configurations": {
"de": {
"aot": true,
"outputPath": "dist/my-project-de/",
"baseHref": "/fr/",
"i18nFile": "src/locale/messages.de.xlf",
"i18nFormat": "xlf",
"i18nLocale": "de",
"i18nMissingTranslation": "error",
}
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
constructor(myElement: ElementRef) {
el.nativeElement.style.backgroundColor = 'yellow';
}
⬆ Back to Top
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 59/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
⬆ Back to Top
⬆ Back to Top
i. Add schematics: These schematics are used to install library in an Angular workspace using ng add command. For
example, @angular/material schematic tells the add command to install and set up Angular Material and theming.
ii. Generate schematics: These schematics are used to modify projects, add configurations and scripts, and scaffold
artifacts in library using ng generate command. For example, @angular/material generation schematic supplies
generation schematics for the UI components. Let's say the table component is generated using ng generate
@angular/material:table .
iii. Update schematics: These schematics are used to update library's dependencies and adjust for breaking changes
in a new library release using ng update command. For example, @angular/material update schematic updates
material and cdk dependencies using ng update @angular/material command.
⬆ Back to Top
i. Install the dependency: At first, install the jquery dependency using npm
ii. Add the jquery script: In Angular-CLI project, add the relative path to jquery in the angular.json file.
"scripts": [
"node_modules/jquery/dist/jquery.min.js"
]
iii. Start using jquery: Define the element in template. Whereas declare the jquery variable and apply CSS classes on
the element.
<div id="elementId">
<h1>JQuery integration</h1>
</div>
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
https://github.com/sudheerj/angular-interview-questions 60/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
ngOnInit(): void {
$(document).ready(() => {
$('#elementId').css({'text-color': 'blue', 'font-size': '150%'});
});
}
}
⬆ Back to Top
@NgModule({
imports: [
BrowserModule,
HttpClientModule,
],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
⬆ Back to Top
You can access the current RouterState from anywhere in the Angular app using the Router service and the routerState
property.
⬆ Back to Top
But if you are changing your existing style in your project then use ng set command,
⬆ Back to Top
<div [hidden]="!user.name">
My name is: {{user.name}}
</div>
⬆ Back to Top
⬆ Back to Top
For example, you can provide 'hello' list based on a greeting array,
@Component({
selector: 'list-pipe',
template: `<ul>
<li *ngFor="let i of greeting | slice:0:5">{{i}}</li>
</ul>`
})
export class PipeListComponent {
greeting: string[] = ['h', 'e', 'l', 'l', 'o', 'm','o', 'r', 'n', 'i', 'n', 'g'];
}
⬆ Back to Top
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 62/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
⬆ Back to Top
<div [ngSwitch]="currentBrowser.name">
<chrome-browser *ngSwitchCase="'chrome'" [item]="currentBrowser"></chrome-browser>
<firefox-browser *ngSwitchCase="'firefox'" [item]="currentBrowser"></firefox-browser>
<opera-browser *ngSwitchCase="'opera'" [item]="currentBrowser"></opera-browser>
<safari-browser *ngSwitchCase="'safari'" [item]="currentBrowser"></safari-browser>
<ie-browser *ngSwitchDefault [item]="currentItem"></ie-browser>
</div>
⬆ Back to Top
i. Aliasing in metadata: The inputs and outputs in the metadata aliased using a colon-delimited (:) string with the
directive property name on the left and the public alias on the right. i.e. It will be in the format of
propertyName:alias.
ii. Aliasing with @Input()/@Output() decorator: The alias can be specified for the property name by passing the
alias name to the @Input()/@Output() decorator.i.e. It will be in the form of @Input(alias) or @Output(alias).
⬆ Back to Top
Using this safe navigation operator, Angular framework stops evaluating the expression when it hits the first null value
and renders the view without any errors.
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 63/64
3/11/2020 sudheerj/angular-interview-questions: List of 300 Angular Interview Questions and answers[WIP]
You don't need any special configuration. In Angular9, the Ivy renderer is the default Angular compiler. Even though Ivy
is available Angular8 itself, you had to configure it in tsconfig.json file as below,
⬆ Back to Top
⬆ Back to Top
⬆ Back to Top
i. Pipe operator
ii. Safe navigation operator
iii. Non-null assertion operator
⬆ Back to Top
⬆ Back to Top
https://github.com/sudheerj/angular-interview-questions 64/64