Angular 2+ Flashcards

1
Q

What is name of a special function of class which gets called when object is created and it’s syntax in Typescript?

A

constructor  —  constructor(){}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the basic rules of Decorators?

A

a function which has annotation of @() with optional parameters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

If you do not know the number of arguments to be passed to function in advance, you should use _______ parameter type.

A

Rest parameter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

_____ keyword is used to access class’s member variables and functions inside class member function.

A

this

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In Angular, you can pass data from parent component to child component using

A

@Input()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In Angular, you can pass data from child component to parent component using

A

@Output()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Write a syntax for ngFor with <li> example.</li>

A

<li>
{{item}}
</li>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

We must import ____________ module to use [(ngModel)].

A

FormsModule

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Import ____________ module to use reactive form.

A

ReactiveFormsModule

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Write an example to define custom event with Boolean argument with code and passing data to parent component.

A

objEvent = new EventEmitter();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Write a syntax to bind custom CSS class (e.g. highlighted) to a <div> tag.</div>

A

<div></div>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

You can create local HTML reference of HTML tag using variable which starts with character

A

#

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

You can access HTML local reference alias in component’s typescript code using ___________ decorator.

A

@ViewChild()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

In template driven form _________ object is created internally whenever we have below code

A

FormGroup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Choose correct form control class name which is set to true when value is modified

A

.ng-dirty

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

If you provide a service in two components’ “providers” section of @Component decorator, how many instances of service shall get created?

A

2

17
Q

When you apply ‘pipe’, it changes value of underlying component’s member variable as well.

A

False

18
Q

In routing, below tag is used to show selected route component dynamically

A
19
Q

We need to call below method of RouterModule for providing all routes in AppModule

A

RouterModule.forRoot

20
Q

Angular web application can only be written using Typescript as code behind language

A

False

21
Q

Fill in blank keyword used to implement inheritance in typescript?
_________

A

extends

22
Q

Decorator is a class?

A

False

23
Q

Optional parameter is marked using below syntax:

A

Fun(name?:string)

24
Q

We can have constructor overloading in Typescript

A

False

25
Q

In Angular, you can hide/remove HTML element using

A

*ngIf

26
Q

There can be more than one RootModule in Angular

A

False

27
Q

ngFor can be applied on any HTML tag e.g.<div> and not just <li></div>

A

True

28
Q

We can implement two-way data binding using

A

[(ngModel)]

29
Q

For standard HTML onclick event, we can have below Angular event

A

(click)

30
Q

EventEmitter data type implementation uses generics concept of Typescript.

A

True

31
Q

You can update background color of <div> HTML tag using [ngStyle]</div>

A

True

32
Q

You can have more than one #local variable for an HTML element. E.g.

A

False

33
Q

Angular custom/built-in Directives cannot listen to standard HTML event raised on their host

A

False

34
Q

Using Template Driven Form, you can create dynamic form layout

A

False

35
Q

Choose correct form control class name which is set to true when blur event gets fired on control

A

.ng-touched

36
Q

Angular Service can be injected at Root Module, Feature Module or Component level

A

True

37
Q

You can modify DOM of target element using Pipe

A

False

38
Q

You can define 404 route using below wild card route path

A

**

39
Q

Below service can be injected in your component to do dynamic route navigation

A

Router