I'm wondering which of the following is better
<my-component [data]="settings"></my-component>
or
<my-component
[bar]="settings.foo.bar"
[baz]=settings.baz"></my-component>
And the settings object would then look like this
this.settings = {
foo: { bar: 10 }
baz: 2
};
The first form is compact, but less explicit about what my-component
needs. I can image that there are situation in which it could be better to pass whole objects to a component (if there are too many properties for example). And what about performance. I can image that change detection is harder and less performant if you pass around whole objects. Any help/tips regarding this subject would be appreciated!