function Demo(){
var demo = this;
demo.myAction = function(){
alert('It works!');
};
demo.message = "Hello World";
}
Demo.annotations = [
new angular.ComponentAnnotation({
selector: "demo"
}),
new angular.ViewAnnotation({
template: '<div (click)="myAction()">{{message}}</div>'
})
];
//do not need event listener in JSFiddle but will in
//you web app
/*
document.addEventListener("DOMContentLoaded", function(){
angular.bootstrap(Demo);
})
*/
angular.bootstrap(Demo);
<demo></demo>
div {
margin-top:50px;
cursor:pointer;
}
External resources loaded into this fiddle: