这是我的组件,其属性是
类型 @Component({
selector: 'canvasContainer',
properties: ['type']
})
@View({
templateUrl: "components/canvas/canvas.html",
directives: [Bar, CORE_DIRECTIVES],
styleUrls: ['app.css']
})
export class Canvas
{
constructor() { }
}
这是我的html页面:
<bar type="pie"></bar>
我想在我的构造函数中获取类型派,如下所示:
@Component({
selector: 'canvasContainer',
properties: ['type']
})
@View({
templateUrl: "components/canvas/canvas.html",
directives: [Bar, CORE_DIRECTIVES],
styleUrls: ['app.css']
})
export class Canvas
{
constructor() { alert(type); }//this alert is not working
}