I've created a directive with an isolate scope that maps a list of objects to inputs for modifying a specific property. However, I now aim to make this component more universal by allowing it to bind to deeply nested properties within each object.
For instance, consider a list of people with names spoken in various languages:
var people = [
{
age: 31,
multilang_attributes: {
en: {name: 'John'},
ru: {name: 'Иван'}
}
},
{
age: 29,
multilang_attributes: {
en: {name: 'Peter'},
ru: {name: 'Пётр'}
}
},
];
I'd like to use my universal component on this list of people as shown below:
<input-list
items="people",
item-model="multilang_attributes[locale].name"
></input-list>
I attempted creating a scope property using `&` to execute the expression in the parent scope and then pass it to `ngModel`, but encountered issues. You can check out my attempt on plunkr here.
What would be the best approach to solve this task in Angular?