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?

17
Q

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

18
Q

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

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

21
Q

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

22
Q

Decorator is a class?

23
Q

Optional parameter is marked using below syntax:

A

Fun(name?:string)

24
Q

We can have constructor overloading in Typescript

25
In Angular, you can hide/remove HTML element using
*ngIf
26
There can be more than one RootModule in Angular
False
27
ngFor can be applied on any HTML tag e.g.
and not just
  • True
    28
    We can implement two-way data binding using
    [(ngModel)]
    29
    For standard HTML onclick event, we can have below Angular event
    (click)
    30
    EventEmitter data type implementation uses generics concept of Typescript.
    True
    31
    You can update background color of
    HTML tag using [ngStyle]
    True
    32
    You can have more than one #local variable for an HTML element. E.g.
    False
    33
    Angular custom/built-in Directives cannot listen to standard HTML event raised on their host
    False
    34
    Using Template Driven Form, you can create dynamic form layout
    False
    35
    Choose correct form control class name which is set to true when blur event gets fired on control
    .ng-touched
    36
    Angular Service can be injected at Root Module, Feature Module or Component level
    True
    37
    You can modify DOM of target element using Pipe
    False
    38
    You can define 404 route using below wild card route path
    **
    39
    Below service can be injected in your component to do dynamic route navigation
    Router