angular-translate国际化

1、<h1>{{"hello" | translate}}</h1>
2、<h1 ng-bind-html="'hello' | translate"></h1>
3、<span translate="hello"></span>

 1  <script src="~/Scripts/angular.min.js"></script>
 2  <script src="~/Scripts/angular-translate.min.js"></script>
 3  <script type="text/javascript">
 4   var app = angular.module("app", ['pascalprecht.translate']);
 5   app.config(['$translateProvider', function ($translateProvider) {
 6    $translateProvider.translations('zh-cn', {
 7     'hello': '你好',
 8    });
 9 
10    $translateProvider.preferredLanguage('zh-cn');
11   }]);
12  </script>
13 </head>
14 <body>
15  <h1>{{"hello" | translate}}</h1>
16 </body>

 

 



posted @ 2018-01-26 14:39  安云  阅读(182)  评论(0编辑  收藏  举报