I am having trouble integrating ng2-translate into angular 2 RC5 for components other than the main application.
I want to use the handset globally, and during the research I found that I probably need to use a “provider” (but this is on RC4), and then I found that I need to use “ads”. Any ideas?
As always ... thank you very much for your help!
When I use in the template file:
{{'HOME.TITLE' | translate}}
I get this error in the browser:
The pipe 'translate' could not be found ("<h1>title test</h1>
<h2>[ERROR ->]{{ 'HOME.TITLE' | translate }}</h2>
This is my main.ts file:
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
platformBrowserDynamic().bootstrapModule(AppModule);
The main module file:
import {TranslateModule, TranslateService} from "ng2-translate/ng2-translate";
@NgModule({
imports: [
BrowserModule,
HttpModule,
RouterModule.forRoot(routes),
AboutModule,
HomeModule,
SharedModule.forRoot(),
TranslateModule.forRoot()
],
declarations: [AppComponent],
providers: [{
provide: APP_BASE_HREF,
useValue: '<%= APP_BASE %>'
}],
bootstrap: [AppComponent]
})
export class AppModule { }
source
share