angular6.0.0中使用ngx-translate

一、安装

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

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

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

一定要注意版本问题

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  

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值