GithubHelp home page GithubHelp logo

Comments (7)

tflori avatar tflori commented on August 16, 2024

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.

tflori avatar tflori commented on August 16, 2024

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.

robie2011 avatar robie2011 commented on August 16, 2024

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.

tflori avatar tflori commented on August 16, 2024

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.

tflori avatar tflori commented on August 16, 2024

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.

robie2011 avatar robie2011 commented on August 16, 2024

yes, I did.

I see. This must be an issue with angular-cli.

from angular-translator.

tflori avatar tflori commented on August 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.