Angular Interview Questions and Answers
Related differences
Angular vs React | AngularJS vs NodeJS | AngularJS vs Angular |
Data direction | Syntax | Type |
---|---|---|
From the source-to-view(One-way) | 1. {{expression}} 2. [target]="expression" 3. bind-target="expression" | Interpolation, Property, Attribute, Class, Style |
From view-to-source(One-way) | 1. (target)="statement" 2. on-target="statement" | Event |
View-to-source-to-view(Two-way) | 1. [(target)]="expression" 2. bindon-target="expression" | Two-way |
Ques 30. What are pipes in Angular?
A pipe takes in data as input and transforms it to a desired output. For example, let us take a pipe to transform a component's birthday property into a human-friendly date using date pipe.
import { Component } from '@angular/core';
@Component({
selector: 'app-birthday',
template: `<p>Birthday is {{ birthday | date }}</p>`
})
export class BirthdayComponent {
birthday = new Date(1987, 6, 18); // June 18, 1987
}
Most helpful rated by users: