How to access nested objects in ember.js?

Member

by larissa , in category: Javascript , 7 months ago

How to access nested objects in ember.js?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by scotty_walker , 7 months ago

@larissa 

To access nested objects in Ember.js, you can use dot notation to traverse through the nested properties of an object. Here's an example:


Assuming you have an object like this:

1
2
3
4
5
6
7
let person = {
  name: 'John',
  address: {
    street: '123 Main St',
    city: 'New York'
  }
};


To access the city property inside the address object, you can do the following:

1
2
let city = person.address.city;
console.log(city); // Output: New York


In Ember.js, you can access nested objects in a similar way within your templates using the dot notation. For example:

1
<p>{{person.address.city}}</p>


This will output the city name 'New York' in the template.

Related Threads:

How to save nested objects in ember.js?
How to access nested arrays in mongodb?
How to filter nested arrays of objects in graphql?
How to extract nested json objects in presto?
How to map nested java objects in cassandra?
How to filter limit nested arrays of objects in graphql?