KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Have a kind of price range/rating functionality based on an inputs model. On load, when it's set from the backend, it starts off as an integer, but when you type in it, it changes to a string. Is there any way in Angular to declare the value of an input as integer? HTML: <input type="text" name="sellPrice" id="sellPrice" class="sell-price" data-ng-model="menu.totalPrice" data-ng-change="updateMenuPriceRange()"required> JS: $scope.updateAggregatePricing(); if ($scope.menu.totalPrice === 0) { $scope.menuPriceRange = ""; } else if ($scope.menu.totalPrice < 10) { $scope.menuPriceRange = "$"; } else if ($scope.menu.totalPrice >= 10 && $scope.menu.totalPrice <= 12.50) { $scope.menuPriceRange = "$$"; } else if ($scope.menu.totalPrice >= 12.51 && $scope.menu.totalPrice < 15) { $scope.menuPriceRange = "$$$"; } if ($scope.menu.totalPrice >= 15) { $scope.menuPriceRange = "$$$$"; } else { $scope.menuPriceRange = ""; }
Tags (comma-separated)
Save Edits
Cancel