21 lines
		
	
	
		
			499 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			499 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| // #docregion
 | |
| import { Component, OnInit } from '@angular/core';
 | |
| 
 | |
| import { TwainService } from './twain.service';
 | |
| 
 | |
| // #docregion component
 | |
| @Component({
 | |
|   selector: 'twain-quote',
 | |
|   template: '<p class="twain"><i>{{quote}}</i></p>'
 | |
| })
 | |
| export class TwainComponent  implements OnInit {
 | |
|   intervalId: number;
 | |
|   quote = '...';
 | |
|   constructor(private twainService: TwainService) { }
 | |
| 
 | |
|   ngOnInit(): void {
 | |
|     this.twainService.getQuote().then(quote => this.quote = quote);
 | |
|   }
 | |
| }
 | |
| // #enddocregion component
 |