Very simple issue I cant seem to resolve, my markup
<select class="testing" ng-model="Car_name" ng-options="item in categories['Car_name']">
I'm trying to change 'Car_name' to be 'car_name' however the server populated the ng-model & categories[] entries, so I'm not sure how I can watch and convert to lowercase in my controller.
If I could do
{{Car_name|lowercase}}
would be the easiest, but not sure on the format.
The toLowerCase () method converts a string to lowercase letters. The toLowerCase () method does not change the original string. The string converted to lowercase. toLowerCase () is an ES1 feature (JavaScript 1997).
Angular lowercase Pipe used to convert string or text to lowercase in Angular component templates. To convert a string to small letters in template HTML file, pass the input string to the lowercase pipe using pipe operator as shown below. <p> { {'LOWERCASE pipe convert string to small letters in ANGULAR' | lowercase}}</p> <!--
The toLowerCase () method returns the value of the string converted to lower case. toLowerCase () does not affect the value of the string str itself. The compatibility table on this page is generated from structured data.
toLowerCase () is an ES1 feature (JavaScript 1997). It is fully supported in all browsers:
This is built into AngularJS and can be access via angular.lowercase(string);
and then used in your Controller like:
$scope.makeLowerCase = function(string){
return angular.lowercase(string);
};
Now use in your DOM like:
{{Car_name|makeLowerCase}}
You can do it by using angular.$filter option
Sample look like
<td ng-model={{ lowercase_expression | lowercase}}><td>
$filter('lowercase')()
More details Please see this angular document
Please see this below discussion
AngularJS - ngOptions expressions
You need to manually add a loop for your array
. And convert to the object values to lower case by using toLowerCase()
function , and finally push the object to new array.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With