Hello, 
 
 Working on a Angular 4 project and I'm trying to extract the individula 
values from the testArray with out running it through the Angular *ngFor 
directive. 
 I am able to display the information if i use *ngFor directive but 
unfortunatly i need to do this without putting it through the ngFor 
directive.
 
 the data is queried from a database and the results is:

 testArray = 
[ { "firstName": "Bruce", "lastName": "Wayne", "superHero": "Batman", 
"age": "45" }, 
  { "address": "45 Green St", "city": "New York", "Car": "Focus", "color": 
"Green" } ]

 
 I tried the following:

 {{testArray[0]?.lastName}}* and the results is Wayn*e and it works but it 
also throws an error "TypeError: Cannot read property '0' of undefined"

 {{testArray[1]['address']}} *and the results is 45 Green St.* but at the 
same time it throws an error: "TypeError: Cannot read property '1' of 
undefined" 
 
 what am i doing wrong. 
 
 Any help you can provide would be greatly appreciated.
 Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" 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.

Reply via email to