Skip to content

Conversation

@kamilkisiela
Copy link
Member

We don't have to specify the property key of data object.

  • few tests of AngularQueryPipe
  • code is now much cleaner

Now it works like this:

<li *ngFor="#user of users | async | apolloQuery">
     {{ user.firstName }} {{ user.lastName }}
</li>

Instead of this:

<li *ngFor="#user of users | async | apolloQuery:'users'">
     {{ user.firstName }} {{ user.lastName }}
</li>

@stubailo
Copy link
Contributor

I guess I'm not really sure that saving people from typing result.data.queryName.user is that important, but maybe it is!

@kamilkisiela
Copy link
Member Author

@stubailo I totally agree with you!

The thing is that it's just nice to bring some magic and to bind let's say getUsers query into users variable and deal with it without any additional work.

In angular2 AsyncPipe automatically subscribes to an observable and unsubscribes it when the component is being destroyed. So we don't really need ApolloQueryPipe at all. It is just to make it easier and cleaner.

@kamilkisiela
Copy link
Member Author

kamilkisiela commented Apr 21, 2016

As you can see here examples/hello-world/client/main.ts#L41-L56, without ApolloQueryPipe it would look like this:

<li *ngFor="#user of users.data.users">
     {{ user.firstName }} {{ user.lastName }}
</li>

@stubailo and thanks for mentioning me here 👊 😄

@Urigo
Copy link
Member

Urigo commented Apr 22, 2016

@stubailo I like that shorter syntax, also, if we won't make the observable return its data directly as discussed here: apollographql/apollo-client#139 (comment)
I want to syntax to look at least relatevely simple to other APIs for Angular 2.0 like AngularFire 2.0 where you should just use the async pipe.

@sebakerckhof
Copy link

Well, I don't like typing, so shorter syntax is important ;)

@coveralls
Copy link

coveralls commented Jun 1, 2016

Coverage Status

Coverage remained the same at 100.0% when pulling 2b3b493 on kamilkisiela:feat/default-data into 94667db on apollostack:master.

@Urigo Urigo closed this Jun 15, 2016
@kamilkisiela kamilkisiela deleted the feat/default-data branch June 15, 2016 21:21
jbaxleyiii pushed a commit that referenced this pull request Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants