@PCotter wrote:
I need to convert the select option input into a number when submitting the input. The HTML code looks numeric but converts to string when passed to the controller and
$scope.mycomment.rating = parseInt($scope.mycomment.rating,10) in my controller does not convert it into an integer.<form ng-submit="submitComment()"> <div class="list"> <label class="item item-input item-select"> <div class="input-label"> Rating </div> <select ng-model="mycomment.rating"> <option ng-repeat="n in [1,2,3,4,5]" value="{{n}}">{{n}}</option> </select> </label>
But
$scope.mycomment.rating = parseInt($scope.mycomment.rating,10)
in controller.js won't fix this. I have also tried using type="number" in the select tag and the option tag with no luck. I can't get an angular filter to work either.
Posts: 1
Participants: 1