I have a list of items. An element can be several things, say a list looks something like this:
[userObject , vehicleObject , userObject , animalObject , animalObject]
Now I want to display a list with the ngRepeat directive, which will use the template according to the type of object (Polymorphic rendering). It can be done?
maybe something like ( ng-use ) is a hypothetical directive):
<ul> <li ng-repeat="item in items"> <img ng-use="item.type == 'user'" ng-src="item.src"> <a ng-use="item.type == 'vehicle'">{{item.link}}</a> <span ng-use="item.type == 'animal'">{{item.name}}</span> </li> </ul>
javascript dom polymorphism angularjs rendering
Shlomi Schwartz Jan 20 '13 at 14:30 2013-01-20 14:30
source share