I have this scenario: I'm using TypeScript, and I want to pass a
"Transport" object that contains an array of "Electrics" nested within an
array of "Cars" from a parent component to its child component.
How do I access a particular "Electric" for purposes of rendering in the
html like this:
<html>
Model
<input [(ngModel)="transport.cars.find(c => c.isActive ==
true).electrics.find(e => e.isActive == true).modelName"] />
<html>
*******
@View({
template: template,
directives: [
ChildComponent,
})
export class ParentComponent{
transport: Transport;
sendTheTransport(){
this.transport = setThisObjectWithData();
}
}
Parent template:
<div>
<child [transport]="transport"></child>
</div>
export class ChildComponent{
@Input() transport: Transport;
Is there a way to intercept the object before the partial HTML is rendered?
This is not scalable:
<html>
Model
<input [(ngModel)="transport.cars[0].electrics[2].modelName"] />
<html>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.