0

http://jsfiddle.net/48yh14c3/

this.list = [
 {
  property: [{anotherProp: true}]
 },
 {
  property: []
 },
 {
  property: [{anotherProp: false}]
 }
]

In angular 1 you could reference deep properties and (for the most part) it would keep on rocking:

<div ng-repeat='thing in ctrl.list'>
   {{thing.property[0].anotherProp}}
</div>

I'm sure I could just *ngIf the parent property to make sure it exists, or flatten the original POJO. Just wondering if I'm missing something?

1 Answer 1

2

Yes, you're missing the Elvis operator:

<div *ngFor='#thing of list'>
   {{thing.property[0]?.anotherProp}}
</div>

Plunker

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.