Something is very wrong with your array/object. And tsc
complains about it. Please check https://stackoverflow.com/a/37824284/1267942
Very lively it's nothing to do do with pipes
and changedetectorRef
, you just need to declare your model correctly.
Update:
There are couple thing here:
Correct way of interacting between parent and child components https://angular.io/docs/ts/latest/cookbook/component-communication.html#
Having common data model for multiple nested components:
Declare a class member in a parent component, like
model: Array<string> = [];
In the template pass it to a child component using two-way binding
<child-component [(modelInChild)]="model"></child-component>
In the child model variable should be declared as
@Input() modelInChild: Array<string> = [];
Then you can pass the variable further to child of child the same way.
Using this method you'll have common data model
in the whole tree of components.
However, this method is not recommended: it's slow, it's hard to track value of a model
, etc.
Component can use itself as a child. I haven't tried this approach yet, but Angular2 Recursive Templates in javascript looks very promising.
For the Collapsible
component check Angular 2 Read More Directive