AngularJS rendering different template inside ng-repeat using ng-view
angularjs, angularjs-ng-repeat, angularjs-routing, ng-view
Solution
You can have only one ng-view, take a look at this answer.
from the documentation for ng-view:
ngView is a directive that complements
the $route service by including the rendered
template of the current route into the main
layout (index.html) file.
Every time the current route changes,
the included view changes with it according
to the configuration of the $route service.
Requires the ngRoute module to be installed.
What you're looking for is ng-include, combined with ng-switch, take a look at this answer on how to combine the two.
ng-include creates a new child scope, which in turn inherits from the controller. have a look at this answer for more information about the topic.
Problem
I would like to apologize that I couldn't provide any code snippet regarding this question, I am a newbie about AngularJS. ``` <div ng-repeat="item in list" ng-view></div> ``` Using the code above, would it be possible to render different template which would be dependent on `item.type` property. I was expecting a result like this: - item.type == "image" returning: `<div><img src="'IMAGE_URI'"></div>` - item.type == "text" returning: `<div><p>TEXT</p></div>` As of now I have create a template html for the enumeration of `item.type`. Is this concern possible using AngularJS? I've recently learned that `ng-view` accompannied with `ng-route`.