I am currently facing a challenge where I need to utilize ng-repeat
for a list. However, the twist is that I already have pre-existing list items that are being rendered with Django.
Note: In my AngularJS InterpolateProvider, I have configured {[{ }]}
.
Sample HTML Code
<ul ng-controller="ListController">
{% for item in existing_list %}
<li>
<span>{{item.firstName}}</span>
<span>{{item.lastName}}</span>
</li>
{% endfor %}
<li ng-repeat="item in items">
<span>{[{item.firstName}]}</span>
<span>{[{item.lastName}]}</span>
</li>
</ul>
My objective now is to manage these items using ng-controller
app.js Script
function ListController($scope){
$scope.items = [{firstName: "Bob", lastName: "Smith"}];
}
The main issue I'm grappling with is how to incorporate the pre-existing list items generated by Django into the $scope.items
array?