Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 7c9ff12

Browse files
wKozawardbell
authored andcommitted
docs(server-communication) Don't use constructor, but rather ngOnInit (#3046)
1 parent f69ef4a commit 7c9ff12

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

public/docs/_examples/server-communication/ts/app/wiki/wiki-smart.component.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* tslint:disable: member-ordering forin */
22
// #docplaster
33
// #docregion
4-
import { Component } from '@angular/core';
4+
import { Component, OnInit } from '@angular/core';
55
import { Observable } from 'rxjs/Observable';
66
// #docregion import-subject
77
import { Subject } from 'rxjs/Subject';
@@ -15,7 +15,7 @@ import { WikipediaService } from './wikipedia.service';
1515
templateUrl: 'wiki.component.html',
1616
providers: [ WikipediaService ]
1717
})
18-
export class WikiSmartComponent {
18+
export class WikiSmartComponent implements OnInit {
1919
title = 'Smarter Wikipedia Demo';
2020
fetches = 'Fetches when typing stops';
2121
items: Observable<string[]>;
@@ -25,7 +25,9 @@ export class WikiSmartComponent {
2525
search(term: string) { this.searchTermStream.next(term); }
2626
// #enddocregion subject
2727

28-
constructor (private wikipediaService: WikipediaService) {
28+
constructor (private wikipediaService: WikipediaService) {}
29+
30+
ngOnInit() {
2931
// #docregion observable-operators
3032
this.items = this.searchTermStream
3133
.debounceTime(300)

0 commit comments

Comments
 (0)