【发布时间】:2014-10-10 14:22:57
【问题描述】:
有没有办法等待组件初始化?
@Component(
selector: "my-component",
templateUrl: 'component/my.html',
useShadowDom: false,
publishAs: "ctrl"
)
class MyComponent {
@NgAttr('foo')
String foo;
}
@NgAttr('bar')
String bar;
}
MyComponent(){
print(foo);
print(bar);
}
}
用法:
<my-component foo="bar" bar="baz"></my-component>
当我像这样使用组件时,构造函数会打印:null, null
我可以为 foo 和 bar 编写一个 setter,并检查每个 set 是否都已设置。但是如果没有提供任何值..我的 init 永远不会被解雇。
我是否必须实现一个提供 init 方法或其他东西的接口?
【问题讨论】:
标签: dart components angular-dart