Comments (7)
It seems angular team changed something in the @NgModule
directive. I didn't tried this version yet.
I'm at work currently. Can you try to export the config and then use it?
config.ts
import { TranslateConfig } from 'angular2-translator/angular2-translator'
export const MyTranslateConfig = new TranslateConfig({...});
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
// import { LanguageComponent } from './language.components';
import { TranslatorModule, TranslateConfig, TranslateService, TranslatePipe } from 'angular2-translator/angular2-translator';
import { MyTranslateConfig } from 'config';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
TranslatorModule
],
providers: [
{ provide: TranslateConfig, useValue: MyTranslateConfig },
TranslatePipe,
TranslateService
],
bootstrap: [AppComponent]
})
export class AppModule { }
WARNING: this is written in the editor and never compiled. Maybe I dont remember the syntax correctly. Please check the syntax 😄
from angular-translator.
may be this file has to be changed as well:
https://github.com/tflori/angular2-translator/blob/master/angular2-translator.ts
I can do this in the evening.
from angular-translator.
I removed alle providers from @NgModule
and get this error
ERROR in Error encountered resolving symbol values statically. Calling function 'TranslateConfig', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol TranslatorModule in /Users/robert/repository/nextlevel17/nl2017-client/node_modules/angular2-translator/angular2-translator.ts, resolving symbol TranslatorModule in /Users/robert/repository/nextlevel17/nl2017-client/node_modules/angular2-translator/angular2-translator.ts
Maybe it would help to replace useValue: new
with useFactory: () => new
?
I'm not familiar with npm packages. I tried to change the source code in node_modules for testing purpose. But I'm getting this error:
ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 29:49 in the original .ts file), resolving symbol TranslatorModule in /Users/robert/repository/nextlevel17/nl2017-client/node_modules/angular2-translator/angular2-translator.ts
from angular-translator.
As I thought - this libray has the same way (create a new object inside providers: {}
property from @NgModule
) of providing the config. This seems not to work anymore. I will investigate in the evening.
from angular-translator.
Sorry, I can't reproduce it. I see you used angular-cli. So you also copied the code to your source folder right?
Maybe you can try download the source from this branch and try it with the code from there - may be it works. But anyway: I don't support angular-cli - especially because it is still beta
from angular-translator.
yes, I did.
I see. This must be an issue with angular-cli.
from angular-translator.
If this fix helps I can publish 1.3.1 from it - if not it would be nice if you find a solution and post it here. Thanks in advance!
from angular-translator.
Related Issues (20)
- Build issue with angular 4.2.3 HOT 16
- Provide a FakeTranslationLoader
- Extending TranslationLoaderJson HOT 4
- Property 'module' does not exist on type '{}' after upgrading to typescript v2.5.1 HOT 4
- Version 2.X documentation update request HOT 1
- Can't resolve parameters for Translator: (?, ?) HOT 2
- Update documentation HOT 1
- Ability to get whole object HOT 4
- Test TranslationLoaderFake
- Defaults back to 'en' HOT 3
- Angular 5 :( HOT 6
- Metadata version mismatch for module ... found version 4, expected 3 HOT 5
- TranslateLogHandler.ts (and other files) is missing from the TypeScript compilation HOT 12
- @ViewChild gives wrong element HOT 1
- Upgrading to Angular 6 and RxJS 6 HOT 2
- No exported member 'Observable' HOT 2
- (intermediate value).share is not a function HOT 10
- Version 3.0 released
- Fallbacks if the key could not be resolved HOT 4
- Generic type 'ModuleWithProviders<T>' requires 1 type argument(s). HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-translator.