Reputation: 10696
Is there anything I can do with very complicated POJOs tree in my template?
e.g.
<div
important-attr="{{item.another_sub_item_three.lets_go_a_little_dipper.property}} "
another-important-attr="{{ item.another_sub_item_three.just_one_more.another-property }}"
>
</div>
Please note I have no control over the data-structure, it comes from legacy API.
Using ng-repeat might be a solution, but this does not feel right, especially since this is not a collection, it's just an item.
<div
ng-repeat="prop in item.another_sub_item_three.lets_go_a_little_dipper"
important-attr="{{prop.property}}"
another-important-attr="{{prop.another-property}}"
>
</div>
Upvotes: 0
Views: 34
Reputation: 7019
If you're using $http
to interface with your legacy API, you could use the transformResponse
property to change the response into a more manageable one.
$http({
method: 'GET',
url: '...',
transformResponse: function(data) {
/* transform data then */
return data
}
})
If you're not using $http
, there's probably another logical place in your code where you can transform the API response before it is consumed by your template.
Upvotes: 0