Reputation: 329
I use angularjs. My html to be comment after render. Why? Before render code:
<select data-ng-model="selectedDate">
<option data-ng-repeat="date in OldRecords" value="{{}}">{{date}}</option>
</select>
After render:
<section>
<select data-ng-model="selectedDate" class="ng-pristine ng-valid">
<!-- ngRepeat: date in OldRecords -->
</select>
</section>
Upvotes: 2
Views: 558
Reputation: 1306
<select data-ng-model="selectedDate">
<option data-ng-repeat="date in OldRecords" value="{{}}">{{date}}</option>
</select>
Here OldRecords
is an Empty Object.So that Angular make that to comment
Upvotes: 0
Reputation: 6619
I have tried the same code and its working fine for me. Here is the link for jsfiddle . Reason you are getting this comments is your list is not able to bind with the options. oldrecords is not able to bind with html. That's the only reason you are getting this comments.
app
angular.module('app', []).
controller('controller1', function($scope){
$scope.OldRecords = ["banana", "apple", "peach"];
});
html:
<section ng-app="app" ng-controller="controller1">
{{dummy}}
<select data-ng-model="selectedDate">
<option data-ng-repeat="date in OldRecords" value="{{}}">{{date}} </option>
</select>
</section>
Upvotes: 0
Reputation: 15767
It is a result of the element transclusion performed by ngRepeat.I think it doesn't affect any of your code or logic. These answers would also help and they also says the same thing
Remove helper HTML comments in Angular JS?
AngularJS leaves comments in HTML: is it possible to remove them?
Upvotes: 0
Reputation: 1125
Its better to use ng-options in this case ,
There is only a comment shown because $scope.OldRecords either doesn't exist or is empty.
Upvotes: 1