AppComponent
AppComponent
is the component of an application that is configured as root component, and it handles the rendering of the app.component.html
template. In the preceding sections, we saw the template code that implemented various pipes and their respective output. The following code snippet shows the component for the template:
import { Component } from '@angular/core'; @Component({ selector: 'pipe-page', templateUrl: 'app/app.component.html' }) export class AppComponent { numberData : number; currencyData : number; dateData : number; authorName : string; object: Object = {autherName: 'Rajesh Gunasundaram', pubName: 'Packt Publishing'} constructor() { this.numberData = 123.456789; this.currencyData = 50; this.dateData = Date.now(); this.authorName = 'rAjEsH gUnAsUnDaRaM'; } }
Pipes, very powerful and simple-to-use APIs provided by Angular, ease our process of formatting data before displaying...