Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Added `fetchMore` support ([PR #58](https://github.com/apollostack/angular2-apollo/pull/58))
- Exposed `ApolloQueryObservable` in the index module ([PR #54](https://github.com/apollostack/angular2-apollo/pull/54))
- Added support for getting `loading` state from ApolloQueryResult [Issue #36](https://github.com/apollostack/angular2-apollo/issues/36) ([PR #43](https://github.com/apollostack/angular2-apollo/pull/43))

### v0.4.1

Expand Down
4 changes: 3 additions & 1 deletion examples/hello-world/client/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ <h2>List</h2>

<input type="search" placeholder="Type name..." [(ngModel)]="nameFilter" />

<ul>
<div *ngIf="data.loading">loading ...</div>

<ul *ngIf="!data.loading">
<li *ngFor="let user of data.users">
{{ user.firstName }} {{ user.lastName }}
</li>
Expand Down
5 changes: 3 additions & 2 deletions src/apolloDecorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,13 @@ class ApolloHandle {
loading: true,
};

const setQuery = ({ errors, data = {} }: any) => {
const setQuery = ({ errors, loading, data = {} }: any) => {
const changed = this.hasDataChanged(queryName, data);

assign(this.component[queryName], {
errors,
loading: false,
// XXX backwards compatibility of loading property
loading: !!loading,
unsubscribe: () => this.getQuerySub(queryName).unsubscribe(),
refetch: (...args) => this.backcompat(queryName, 'refetch', args),
stopPolling: () => this.backcompat(queryName, 'stopPolling'),
Expand Down