componentA.ts:
@Input() array;
<input type="checkbox" [checked]="array | contains: value"/>
<label>{{array.length}}</label>
componentB.ts:
@Component({
selector: 'app-component-b',
templateUrl: './app.component-b.html'
})
export class AppComponentB {
array = [1, 2, 3];
}
I update array
in some other components. While the label
updates the array's length correctly, the check box doesn't seem to be updated. contains
is just a simple pipe that checks if value
is part of array
. I put a console.log
in the contains
pipe and only got the output when the page renders at first, not when array
is changed. Why is this?
Thanks..