Skip to content

Commit 7828857

Browse files
committed
docs(example): update to use new Observable API
1 parent bd2beb3 commit 7828857

File tree

3 files changed

+9011
-19
lines changed

3 files changed

+9011
-19
lines changed

examples/hello-world/package.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@
1212
},
1313
"private": true,
1414
"dependencies": {
15-
"@angular/common": "^2.1.0",
16-
"@angular/compiler": "^2.1.0",
17-
"@angular/compiler-cli": "^2.1.0",
18-
"@angular/core": "^2.1.0",
19-
"@angular/forms": "^2.1.0",
20-
"@angular/http": "^2.1.0",
21-
"@angular/platform-browser": "^2.1.0",
22-
"@angular/platform-browser-dynamic": "^2.1.0",
23-
"@angular/platform-server": "^2.1.0",
24-
"@angular/router": "^3.1.0",
15+
"@angular/common": "~2.1.2",
16+
"@angular/compiler": "~2.1.2",
17+
"@angular/compiler-cli": "~2.1.2",
18+
"@angular/core": "~2.1.2",
19+
"@angular/forms": "~2.1.2",
20+
"@angular/http": "~2.1.2",
21+
"@angular/platform-browser": "~2.1.2",
22+
"@angular/platform-browser-dynamic": "~2.1.2",
23+
"@angular/platform-server": "~2.1.2",
24+
"@angular/router": "~3.1.2",
2525
"angular2-apollo": "file:../../",
2626
"apollo-client": "~0.5.0",
27-
"core-js": "^2.4.0",
28-
"rxjs": "^5.0.0-beta.12",
29-
"ts-helpers": "^1.1.1",
30-
"zone.js": "^0.6.17"
27+
"core-js": "~2.4.0",
28+
"rxjs": "5.0.0-beta.12",
29+
"ts-helpers": "~1.1.1",
30+
"zone.js": "~0.6.26"
3131
},
3232
"devDependencies": {
3333
"@types/es6-shim": "^0.31.32",
@@ -46,11 +46,11 @@
4646
"concurrently": "^2.2.0",
4747
"cors": "^2.8.0",
4848
"express": "^4.14.0",
49-
"graphql": "^0.7.0",
50-
"graphql-tools": "^0.6.5",
49+
"graphql": "~0.7.0",
50+
"graphql-tools": "~0.8.0",
5151
"nodemon": "^1.10.2",
5252
"ts-node": "1.2.1",
53-
"tslint": "3.13.0",
54-
"typescript": "^2.0.6"
53+
"tslint": "~3.15.0",
54+
"typescript": "~2.0.6"
5555
}
5656
}

examples/hello-world/src/app/app.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import gql from 'graphql-tag';
99

1010
import 'rxjs/add/operator/debounceTime';
1111
import 'rxjs/add/operator/map';
12+
import 'rxjs/add/operator/toPromise';
1213

1314
@Component({
1415
selector: 'app-root',
@@ -48,7 +49,7 @@ export class AppComponent implements OnInit, AfterViewInit {
4849
name: this.nameFilter,
4950
},
5051
})
51-
// Return only users, not the whole ApolloQueryResult
52+
// Return only users, not the whole ApolloQueryResult
5253
.map(result => result.data.users) as ApolloQueryObservable<any>;
5354

5455
// Add debounce time to wait 300 ms for a new change instead of keep hitting the server
@@ -88,6 +89,7 @@ export class AppComponent implements OnInit, AfterViewInit {
8889
lastName: this.lastName,
8990
},
9091
})
92+
.toPromise()
9193
.then(({ data }: ApolloQueryResult) => {
9294
console.log('got data', data);
9395

0 commit comments

Comments
 (0)