Skip to content

Instantly share code, notes, and snippets.

@okunokentaro
Last active August 29, 2015 14:23
Show Gist options
  • Save okunokentaro/1c3b8eb0e0ed357e05cb to your computer and use it in GitHub Desktop.
Save okunokentaro/1c3b8eb0e0ed357e05cb to your computer and use it in GitHub Desktop.
Angular 2のpropertyどーするよって話
@Component({
selector: 'organizer',
properties: {
organizer: 'organizer' // Keyは変数名this.organizer, Value は属性名(bindToControllerと一緒、=@&とかはない)
}
})
@View({
directives: [Row, Col, NgFor],
templateUrl: './app/components/organizer.html'
})
export class OrganizerComponent {
posts: any[];
_organizer: string;
constructor() {
console.log('OrganizerComponent constructor', this);
}
set organizer(v: string) {
console.log(v);
this._organizer = v; // ここダサくない!?
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment