ngonchanges

Why angular 2 ngOnChanges not responding to input array push

泪湿孤枕 提交于 2019-12-08 23:37:50
问题 My angular application stuck with a issue, i used input as array and pushed a value to the array when the click event arise. But the ngOnChanges not firing when the array push is done. Is there a way to fire ngOnChange My Code is ts file is @Component({ selector: 'adv-search', templateUrl: './app/modules/result.html' }) export class InputComponent { @Input() metas:any=[]; ngOnChanges() { console.log(this.metas); } } My Selector Tag <adv-search [metas] = "metaIds"></adv-search> Click Event

Why angular 2 ngOnChanges not responding to input array push

一曲冷凌霜 提交于 2019-11-30 17:09:29
My angular application stuck with a issue, i used input as array and pushed a value to the array when the click event arise. But the ngOnChanges not firing when the array push is done. Is there a way to fire ngOnChange My Code is ts file is @Component({ selector: 'adv-search', templateUrl: './app/modules/result.html' }) export class InputComponent { @Input() metas:any=[]; ngOnChanges() { console.log(this.metas); } } My Selector Tag <adv-search [metas] = "metaIds"></adv-search> Click Event Code insertIds(id:any) { metaIds.push(id); } Angular change detection only checks object identity, not

ngOnChanges not working in Angular4

大城市里の小女人 提交于 2019-11-29 16:13:26
I know I am not the first to ask this question ,And I have tried the solutions of so many post in Stackoverflow regarding this but nothing is helped for me . I have an accordion menu in my parent component when the user clicked on those menus the hidden id of the clicked menu will be passed to the child component ,In the child component I need to call the API based on the parent component values . Here I reproduced my issue in Stackblitz ,Please take a look and give me the solution to solve this issue. https://stackblitz.com/edit/angular-bootstrap-carousel-dynamic2-dssqrc?file=app/child/child

ngOnChanges not working in Angular4

天涯浪子 提交于 2019-11-28 10:07:54
问题 I know I am not the first to ask this question ,And I have tried the solutions of so many post in Stackoverflow regarding this but nothing is helped for me . I have an accordion menu in my parent component when the user clicked on those menus the hidden id of the clicked menu will be passed to the child component ,In the child component I need to call the API based on the parent component values . Here I reproduced my issue in Stackblitz ,Please take a look and give me the solution to solve