Angular 2+ Flashcards
What is name of a special function of class which gets called when object is created and it’s syntax in Typescript?
constructor — constructor(){}
What are the basic rules of Decorators?
a function which has annotation of @() with optional parameters
If you do not know the number of arguments to be passed to function in advance, you should use _______ parameter type.
Rest parameter
_____ keyword is used to access class’s member variables and functions inside class member function.
this
In Angular, you can pass data from parent component to child component using
@Input()
In Angular, you can pass data from child component to parent component using
@Output()
Write a syntax for ngFor with <li> example.</li>
<li>
{{item}}
</li>
We must import ____________ module to use [(ngModel)].
FormsModule
Import ____________ module to use reactive form.
ReactiveFormsModule
Write an example to define custom event with Boolean argument with code and passing data to parent component.
objEvent = new EventEmitter();
Write a syntax to bind custom CSS class (e.g. highlighted) to a <div> tag.</div>
<div></div>
You can create local HTML reference of HTML tag using variable which starts with character
#
You can access HTML local reference alias in component’s typescript code using ___________ decorator.
@ViewChild()
In template driven form _________ object is created internally whenever we have below code
FormGroup
Choose correct form control class name which is set to true when value is modified
.ng-dirty
If you provide a service in two components’ “providers” section of @Component decorator, how many instances of service shall get created?
2
When you apply ‘pipe’, it changes value of underlying component’s member variable as well.
False
In routing, below tag is used to show selected route component dynamically
We need to call below method of RouterModule for providing all routes in AppModule
RouterModule.forRoot
Angular web application can only be written using Typescript as code behind language
False
Fill in blank keyword used to implement inheritance in typescript?
_________
extends
Decorator is a class?
False
Optional parameter is marked using below syntax:
Fun(name?:string)
We can have constructor overloading in Typescript
False