diff options
author | zhangab <zhanganbing@chinamobile.com> | 2018-10-23 11:32:03 +0800 |
---|---|---|
committer | zhangab <zhanganbing@chinamobile.com> | 2018-10-23 11:32:05 +0800 |
commit | de9d2e95b43991fccee342ebed03b006f6fed844 (patch) | |
tree | 0667c51a30fd3fed71fec797136d8adefc7d7baf /usecaseui-portal/src/app/app.component.ts | |
parent | 101e5e37f4ece60af8d08020c7e4bd8f473adce7 (diff) |
Build AngularJs component for usecase-ui
Change-Id: I393f4837fc5f9cbd71448dbf20e1f1781f0656d3
Issue-ID: USECASEUI-154
Signed-off-by: zhangab <zhanganbing@chinamobile.com>
Diffstat (limited to 'usecaseui-portal/src/app/app.component.ts')
-rw-r--r-- | usecaseui-portal/src/app/app.component.ts | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/usecaseui-portal/src/app/app.component.ts b/usecaseui-portal/src/app/app.component.ts new file mode 100644 index 00000000..be13c1a1 --- /dev/null +++ b/usecaseui-portal/src/app/app.component.ts @@ -0,0 +1,34 @@ +import { Component } from '@angular/core'; +import { TranslateService } from '@ngx-translate/core'; + + +@Component({ + selector: 'app-root', + templateUrl: './app.component.html', + styleUrls: ['./app.component.less'] +}) +export class AppComponent { + constructor(private translate:TranslateService){ + translate.addLangs(['en', 'zh']); + translate.setDefaultLang('en'); + // translate.use('en'); + } + changeLanguage(Language): void { + switch(Language){ + case 'en': + this.translate.use('en'); + break; + case 'zh': + this.translate.use('zh'); + } + } + // 多语言 + Language:String[] = ["zh","en"]; + selectLanguage = "en"; + changeLanguage1(){ + this.translate.use(this.selectLanguage); + } + changeLanguage2(item){ + this.translate.use(item); + } +} |