Angular 2 @ViewChild returns undefined

后端 未结 6 1218
南旧
南旧 2020-12-15 02:57

I\'ve looked at several related posts and documentation, but still can\'t seem to get expected behavior from @ViewChild.

Ultimately, I\'m trying to set the scroll p

6条回答
  •  一整个雨季
    2020-12-15 03:25

    Subscribing to changes on

    @ViewChildren(MyComponent) childrenComponent: QueryList
    

    confirmed working, combined with setTimeout() and notifyOnChanges() and careful null checking.

    Any other approach produces unreliable results and is hard to test.

提交回复
热议问题