abhishek-nigam
5/6/2018 - 4:21 PM

Pipes in Angular

@Component({
    selector: 'sandbox',
    template: `
        <h1>Hello World</h1> 
        <p>My birthday is {{birthday|date:"MM-dd-yy"}}</p>
        <p>I was born in {{birthday|date:"yyyy"}}
        <p>I love {{'cake'|uppercase}}</p>
        <p>I hate {{'cats'|lowercase}}</p>
        <p>Your total is {{ total | currency:"GBP":"1" }}</p>
        <p>Our fee is {{ fee | percent }}</p>
        `
        // can also create our own custom pipes
})

export class SandboxComponent {
    birthday = new Date(1981, 1, 15);
    total = 500;
    fee = 0.5;
}