+ guide/pipes/ts: update docs and example code + guide/pipes/dart: new prose, updated example code + fix platform_directives reference; html cleanup + enable pipes e2e testing For `e2e-spec.js`: If the async test is executed too early it will fail (simply because the async message hasn’t been received yet). + follow new constants naming convention
		
			
				
	
	
		
			21 lines
		
	
	
		
			565 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			565 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| // #docregion
 | |
| import { Component } from '@angular/core'
 | |
| 
 | |
| @Component({
 | |
|   selector: 'hero-birthday2',
 | |
|   // #docregion template
 | |
|   template: `
 | |
|     <p>The hero's birthday is {{ birthday | date:format }}</p>
 | |
|     <button (click)="toggleFormat()">Toggle Format</button>
 | |
|   `
 | |
|   // #enddocregion template
 | |
| })
 | |
| // #docregion class
 | |
| export class HeroBirthday2 {
 | |
|   birthday = new Date(1988,3,15); // April 15, 1988
 | |
|   toggle = true; // start with true == shortDate
 | |
| 
 | |
|   get format()   { return this.toggle ? 'shortDate' : 'fullDate'}
 | |
|   toggleFormat() { this.toggle = !this.toggle; }
 | |
| }
 |