Chartjs-Angular โ€“ change objects to array and make it listen to on change

0๐Ÿ‘

โœ…

Not sure if I follow you 100% but here is what I can see you asking for:

// return only the id values in your objects
console.log(this.fix.map(x=>x.id));

In order to force updates in a child component I do this:

ParentComponent View

<child-component [fix]="childFixArray"></child-component>

ChildComponent Controller

// This property is bound using its original name.
@Input('childFixArray') fix: [];

// sometimes updates will not occur fi ANgular is not triggered to update the DOM. 
// Use ngOnChanges in the child to monitor for updates
ngOnChanges(changes: SimpleChanges) {
    if ('fix' in changes) {
        // console.log(this.fix);
    }
    this.doSomething(changes.fix.currentValue);
    this.doSomething(changes.fix.previousValue);
    this.doSomething(changes.fix.firstChange);
}

Leave a comment