| 
									
										
										
										
											2015-12-01 12:15:14 +01:00
										 |  |  | // #docregion
 | 
					
						
							| 
									
										
										
										
											2016-05-03 14:06:32 +02:00
										 |  |  | import { Component }        from '@angular/core'; | 
					
						
							|  |  |  | import { Observable }       from 'rxjs/Observable'; | 
					
						
							| 
									
										
										
										
											2016-02-02 11:22:48 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-03 14:06:32 +02:00
										 |  |  | import { WikipediaService } from './wikipedia.service'; | 
					
						
							| 
									
										
										
										
											2015-12-01 12:15:14 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | @Component({ | 
					
						
							| 
									
										
										
										
											2016-10-19 23:17:50 -07:00
										 |  |  |   moduleId: module.id, | 
					
						
							| 
									
										
										
										
											2015-12-01 12:15:14 +01:00
										 |  |  |   selector: 'my-wiki', | 
					
						
							| 
									
										
										
										
											2016-10-19 23:17:50 -07:00
										 |  |  |   templateUrl: 'wiki.component.html', | 
					
						
							|  |  |  |   providers: [ WikipediaService ] | 
					
						
							| 
									
										
										
										
											2015-12-01 12:15:14 +01:00
										 |  |  | }) | 
					
						
							|  |  |  | export class WikiComponent { | 
					
						
							| 
									
										
										
										
											2016-10-19 23:17:50 -07:00
										 |  |  |   title   = 'Wikipedia Demo'; | 
					
						
							|  |  |  |   fetches = 'Fetches after each keystroke'; | 
					
						
							| 
									
										
										
										
											2016-06-08 01:06:25 +02:00
										 |  |  |   items: Observable<string[]>; | 
					
						
							| 
									
										
										
										
											2015-12-01 12:15:14 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   search (term: string) { | 
					
						
							| 
									
										
										
										
											2016-05-03 14:06:32 +02:00
										 |  |  |     this.items = this.wikipediaService.search(term); | 
					
						
							| 
									
										
										
										
											2015-12-01 12:15:14 +01:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-10-19 23:17:50 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   constructor (private wikipediaService: WikipediaService) { } | 
					
						
							| 
									
										
										
										
											2015-12-01 12:15:14 +01:00
										 |  |  | } |