AngularJS /角-UI-引导的日期选择器使用的语言变化 [英] AngularJS/Angular-ui-bootstrap Changing language used by the datePicker

查看:202
本文介绍了AngularJS /角-UI-引导的日期选择器使用的语言变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用的日期选择器记录这里

I use the datePicker documented here.

然而,没有直接的选项可以更改语言,英语默认

However, no direct option allows to change the language, English by default.

我找到一个没有棱角的指令提供widget的文件,它提供了一个很好的方式来实现它:

I find a the documentation of the widget provided without angular directive, and it provides a nice way to achieve it:

<一个href=\"http://bootstrap-datepicker.readthedocs.org/en/latest/i18n.html\">http://bootstrap-datepicker.readthedocs.org/en/latest/i18n.html

有没有一种简单的方法,避免了调整原有指令的源$ C ​​$ C,改变它?

Is there an easy way, avoiding to tweak the original directive's source code, to change it?

推荐答案

如果您正在使用的DatePicker形式角UI只需添加本地化的js文件在你的页面的标题。一个例子是:

If you are using the DatePicker form angular-ui simply add the localized js file in the header of your page. An example would be :

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.js"></script>
<script src="http://code.angularjs.org/1.0.8/i18n/angular-locale_fr-fr.js"></script>
<script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.6.0.js"></script>

您可以看到一个工作plunker 这里

You can see a working plunker here

这篇关于AngularJS /角-UI-引导的日期选择器使用的语言变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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