[英]dart angular2 - input in component instantiated in OnInit method
I try to have a component with an input instantiated in the OnInit
method : 我尝试使用
OnInit
方法实例化具有输入的组件:
<my-component [myInput]="myInput"></my-component>
In my-component, myInput
is always null, as it is not instantiated in the constructor but in OnInit
method. 在my-component中,
myInput
始终为null,因为它不是在构造函数中实例化的,而是在OnInit
方法中实例化的。 I cannot instantiate it in the constructor because I need to call an async method, which is not permitted in the constructor. 我无法在构造函数中实例化它,因为我需要调用异步方法,该方法在构造函数中是不允许的。
Thanks for your help. 谢谢你的帮助。
If I understand you correctly, the Angular2 Tutorial for Dart fits your needs almost perfectly. 如果我理解正确, Dart的Angular2教程几乎可以完全满足您的需求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.