Skip to content

Instantly share code, notes, and snippets.

@yjbanov
Last active August 3, 2016 23:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yjbanov/6819db1440a96c82c1b2b43fdc5f43c4 to your computer and use it in GitHub Desktop.
Save yjbanov/6819db1440a96c82c1b2b43fdc5f43c4 to your computer and use it in GitHub Desktop.
// contact_editor.dart
// - light-weight annotations
// - DI-related annotations OK
@Component('contact-editor')
class ContactEditor {
String get name => 'John Doe';
bool isEditing = false;
}
// contact_editor.html
// - self-sufficient for generating contact_editor.template.dart
// - imports everything used in the template
// - like in Dart everything lexically scoped
import package:angular2/directives.dart
import contact_editor.dart
<ContactEditor>
<div *ngIf="!isEditing">
{{name}}
</div>
<input *ngIf="isEditing" type="text" [value]="name"">
</ContactEditor>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment