Skip to content
Rob edited this page Jan 19, 2015 · 10 revisions

Example

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);
    }
}

selector

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>

bind

todo

observe

todo

controllerAs

todo

componentServices

todo

template

todo

Clone this wiki locally