-
Notifications
You must be signed in to change notification settings - Fork 1
@Component
Rob edited this page Jan 19, 2015
·
10 revisions
import {Component, TemplateConfig} from 'core/core.js';
@Component({
selector: 'my-comp',
bind: {myParam: 'myParam'},
observe: {myParam: 'onParamChange'},
controllerAs: 'ctrl',
componentServices: [MyService],
template: new TemplateConfig({
url: 'path/to/myComp.html',
directives: [MyChildComp]
})
})
class MyComp {
constructor(myService: MyService) {
console.log('myParam: ' + this.myParam);
}
onParamChange(newValue) {
console.log('myParam is now: ' + newValue);
}
}A string representing the css selector for your directive. It can take any of the following forms.
| Style | JavaScript | HTML |
|---|---|---|
| Element | selector: 'my-comp' |
<my-comp></my-comp> |
| Attribute | selector: '[my-comp]' |
<div my-comp></my-comp> |
| Class | selector: '.my-comp' |
<div class="my-comp"></div> |
todo
todo
todo
todo
todo