Skip to content

Instantly share code, notes, and snippets.

@sfroestl
Created February 24, 2016 16:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save sfroestl/010fce74dd7a0ddce968 to your computer and use it in GitHub Desktop.
Save sfroestl/010fce74dd7a0ddce968 to your computer and use it in GitHub Desktop.
User.js
import Relay from 'generic-relay';
import { connectRelay } from 'angular2-relay';
import { Component, View, NgZone } from 'angular2/core';
const UserAccountContainer = Relay.createGenericContainer('User', {
fragments: {
user: () => Relay.QL`
fragment on User {
firstName,
lastName,
}
`,
},
});
@Component({
selector: 'user',
})
@View({
directives: [],
template: `
<div>
<h2>Hi {{ relayData.user.firstName }} {{ relayData.user.lastName }}</h2>
</div>
`,
})
@connectRelay({
container: UserAccountContainer,
})
class User {
constructor(ngZone: NgZone) {
this.initWithRelay(ngZone);
}
}
export { UserAccountContainer, User };
@1roman11
Copy link

j

@RealKilla
Copy link

wow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment