Angular 2 how to make child component wait for async data to be ready

后端 未结 3 1193
遇见更好的自我
遇见更好的自我 2020-12-07 12:53

I\'m passing async data from a parent component to a child component. And the child component needs to know the length of the data in order to do something.

How the

3条回答
  •  余生分开走
    2020-12-07 13:06

    Simpler solution:

    ngOnChanges(changes: SimpleChanges) {
        if (changes['items'].currentValue) {
            this.items = items
        }
    }
    

提交回复
热议问题