tolowercase字符串Angular [英] tolowercase string Angular

查看:92
本文介绍了tolowercase字符串Angular的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

非常简单的问题我似乎无法解决,我的标记

Very simple issue I cant seem to resolve, my markup

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

我正在尝试将'Car_name'更改为'car_name'但是服务器填充了ng-模特& categories []条目,所以我不确定如何在我的控制器中观看和转换为小写。

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.

如果我能做到

{{Car_name|lowercase}} 

将是最简单的,但不确定格式。

would be the easiest, but not sure on the format.

推荐答案

这是内置于AngularJS中,可以通过 angular.lowercase(string); 然后在您的控制器中使用,如:

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);
};

现在在您的DOM中使用如下:

Now use in your DOM like:

{{Car_name | makeLowerCase}}

这篇关于tolowercase字符串Angular的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆