Quantcast
Viewing all articles
Browse latest Browse all 4827

Ember data plain array attribute

@mario.gomez wrote:

How can I model an object that has a plain array of strings? If I do the following it shows me the emails but when modifying their value they are not updated.

The server sends/receives the following data:

   "data":
	[
		{
			"attributes" : {
				"id":1,
				"name":"Jhon",
				"emails":["jhon@gmail.com","jhon@other.com"]},
				"relationships": (,..}
			}
		}

		...

Model:

export default Model.extend({
	id: attr('string'),
	name: attr('string'),
	emails: attr()
})

Template:

{{#each model.emails as |email|}}
	<input type="text" value={{email}}>
{{/each}}

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4827

Trending Articles