feat(view): adds event binding to view instantiation.

Only native non-bubbling events are supported by the commit.
This commit is contained in:
Rado Kirov
2015-01-12 11:50:54 -08:00
parent bccc863567
commit c5b0baf805
6 changed files with 75 additions and 7 deletions

View File

@ -20,7 +20,8 @@ import {bootstrap, Component, Decorator, TemplateConfig, NgElement} from 'core/c
// The template for the component.
// Expressions in the template (like {{greeting}}) are evaluated in the
// context of the HelloCmp class below.
inline: `{{greeting}} <span red>world</span>!`,
inline: `<div>{{greeting}} <span red>world</span>!</div>
<button (click)="changeGreeting()">change greeting</button>`,
// All directives used in the template need to be specified. This allows for
// modularity (RedDec can only be used in this template)
// and better tooling (the template can be invalidated if the attribute is
@ -33,6 +34,9 @@ class HelloCmp {
constructor(service: GreetingService) {
this.greeting = service.greeting;
}
changeGreeting() {
this.greeting = 'howdy';
}
}
// Decorators are light-weight. They don't allow for templates, or new