我想使用ng2-translate
。我看了this tutorial ..我做错了什么?
这是我的组件:
...
import {TranslateService, TranslatePipe, TranslateLoader, TranslateStaticLoader} from 'ng2-translate/ng2-translate';
import {Http as ngHttp, HTTP_PROVIDERS } from '@angular/http';
import {Http} from '../shared/common/http'
@Component({
templateUrl: './app.html',
pipes: [TranslatePipe]
})
类别:
export class MyApp {
constructor(platform: Platform,
private menu: MenuController,
private taxFileService: TaxFileService,
private http: Http,
private menuService: MenuService,
private accountService: AccountService,
private sessionService: SessionService,
**private translate: TranslateService**)
Ionic bootstrap:
ionicBootstrap(MyApp, [[provide(TranslateLoader, {
useFactory: (http: ngHttp) => new CustomLoader(),
deps: [ngHttp]
}),
TranslateService,StorageService, TaxFileService, MenuService, AccountService, Logger, SessionService, Http,HTTP_PROVIDERS]], {
});
我的CustomLoader:
class CustomLoader implements TranslateLoader {
getTranslation(lang: string): Observable<any> {
return Observable.of({"USER": "UserEng"});
}
}
错误在哪里?