NgComponent就绪事件

时间:2014-02-28 19:09:16

标签: dart angular-dart

我正在尝试创建一个NgComponent,在加载组件时会填充元素。如何知道组件何时填充模板?以下是我的一些代码:

class SleepTimeModule extends Module {
  SleepTimeModule() {
    //...
    type(SleepGraph);
    //...
  }
}

//...

@NgComponent(
  selector: 'sleep-graph',
  publishAs: 'sleepGraph',
  template: '<div><svg></svg></div>'
)
class SleepGraph {
  Element element;
  Scope scope;

  @NgTwoWay('data')
  var data;

  SleepGraph(this.element, this.scope);

  // when can I call this method?
  // it modifies the dom
  drawChart(data){
    js.context.callMethod("drawChart", [
      element.shadowRoot.querySelector("svg"),
      new js.JsObject.jsify(data)
    ]);
  }
}

1 个答案:

答案 0 :(得分:0)

实施NgShadowRootAware的{​​{1}}方法,如下所示:

onShadowRoot

已经有类似的问题: