【发布时间】:2016-05-05 14:40:27
【问题描述】:
我在 Angular 2 中使用更改检测来观察深层数组中的更改。请看这个plunker...
http://plnkr.co/edit/zcl9pT?p=preview
在不使用 changeDetectionStrategy 的情况下,有没有办法做我正在做的事情?不得不将其注入父组件中似乎有点矫枉过正。我真的只需要它来循环遍历选定过滤器列表的指令。
@Component({
selector: 'hello-world',
templateUrl: 'src/hello_world.html',
providers: [MyService],
pipes: [keyValueFilterPipe, ValuesPipe, AsyncPipe],
directives: [MyDirective, MyDirective2],
changeDetection: ChangeDetectionStrategy.CheckAlways
})
export class HelloWorld {
constructor(){}
}
}
【问题讨论】:
-
似乎它适用于 beta17 plnkr.co/edit/SwbjKn2M9NBBOYD29IML?p=preview
标签: angularjs typescript angular