Reputation: 8225
I'm getting dynamic data from ajax call which I want to append to a div container with the results from the call but the div is not rendered for some reason.
This is what I have, in the controller:
$http({
method: 'GET',
url: '/Search/SearchParts',
params: { id: id, packageid: $scope.packageid, searchterm: item.SearchValue }
}).success(function (data) {
$scope.searchresults = data;
});
And then in the html I have this:
<modal title="Search for parts" visible="showSearchForm">
<div class="container">
<div class="col-xs-4">
<div class="row">
Enter Search Criteria:
<input type="text" ng-model="item.SearchValue"
class="form-control"/>
</div>
<div class="row">
<button ng-click="searchPart(item)"
class="btn btn-success pull-right">Search Part</button>
<input type="hidden"
ng-model="$scope.packageid"
id="hfVehiclePackageIdSearchPart"/>
</div>
<div class="row" data-ng-repeat="result in $scope.searchresults">
<label>{{result.linecode}}</label>
</div>
</div>
</div>
</modal>
The last div which has ng-repeat with the data is not being rendered.
Any idea what am I doing wrong?
Upvotes: 0
Views: 558
Reputation: 11576
You should not use $scope
in you template files you should use like
<div class="row" data-ng-repeat="result in searchresults"><!-- remove $scope -->
You have another line here also
<input type="hidden"
ng-model="packageid" <!-- remove $scope -->
id="hfVehiclePackageIdSearchPart" />
Upvotes: 1
Reputation: 3971
You don't have to reference $scope in your html.
You can use the models directly like ng-repeat="result in results".
Upvotes: 0