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