Row tolowercase angular

A very simple problem that I cannot solve, my markup

<select class="testing" ng-model="Car_name"  ng-options="item in categories['Car_name']">

I am trying to change "Car_name" to "car_name", however the server filled in the ng-model and categories [] entries, so I'm not sure how I can look and convert to lowercase letters in my controller.

If I could do

{{Car_name|lowercase}} 

It will be the simplest, but not confident in the format.

+4
source share
2 answers

This is built into AngularJS and can be accessed through angular.lowercase(string);and then used in your controller, for example:

$scope.makeLowerCase = function(string){
   return angular.lowercase(string);
};

Now use in the DOM, for example:

{{Car_name|makeLowerCase}}

+8
source

Option 1

You can do this using angular. $ filter option

An example looks like

<td ng-model={{ lowercase_expression | lowercase}}><td>

$filter('lowercase')()

. angular


2

,

AngularJS - ngOptions


3

array. toLowerCase() , , .


+5

All Articles