您的位置:首页 > Web前端 > AngularJS

angular6.0.0中使用ngx-translate

2018-10-11 18:56 267 查看

一、安装

ngx-translate官网地址http://www.ngx-translate.com/    github地址https://github.com/ngx-translate/core

我们在应用中会使用到如下两个模块

  1. 1  安装
    [code]npm install @ngx-translate/core@10.0.0 --save

一定要注意版本问题

[code]npm install @ngx-translate/http-loader@3.0.0 --save

 

二、使用

看两个例子你就明白了!

https://stackblitz.com/github/ngx-translate/example?file=src%2Fapp%2Fapp.module.ts  

https://github.com/ngx-translate

需要注意的是,如果你有很多子模块,一定要把TranslateModule 导入到要使用的各个子模块中去,而不是只在appmodule里导入。文档中有提及,注意看这里 https://github.com/ngx-translate/core

https://stackoverflow.com/questions/40538550/angular-2-0-translate-pipe-could-not-be-found  也可以看这里

 

三、用法

三种方式:Use the service, the pipe or the directive:

看文档  https://github.com/ngx-translate/core  

 

 

 

阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: