docs(server-communication) Don't use constructor, but rather ngOnInit (#3046)
This commit is contained in:
parent
f69ef4ac36
commit
7c9ff12a76
@ -1,7 +1,7 @@
|
||||
/* tslint:disable: member-ordering forin */
|
||||
// #docplaster
|
||||
// #docregion
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
// #docregion import-subject
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
@ -15,7 +15,7 @@ import { WikipediaService } from './wikipedia.service';
|
||||
templateUrl: 'wiki.component.html',
|
||||
providers: [ WikipediaService ]
|
||||
})
|
||||
export class WikiSmartComponent {
|
||||
export class WikiSmartComponent implements OnInit {
|
||||
title = 'Smarter Wikipedia Demo';
|
||||
fetches = 'Fetches when typing stops';
|
||||
items: Observable<string[]>;
|
||||
@ -25,7 +25,9 @@ export class WikiSmartComponent {
|
||||
search(term: string) { this.searchTermStream.next(term); }
|
||||
// #enddocregion subject
|
||||
|
||||
constructor (private wikipediaService: WikipediaService) {
|
||||
constructor (private wikipediaService: WikipediaService) {}
|
||||
|
||||
ngOnInit() {
|
||||
// #docregion observable-operators
|
||||
this.items = this.searchTermStream
|
||||
.debounceTime(300)
|
||||
|
Loading…
x
Reference in New Issue
Block a user