Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to include library as NgModule? #16

Open
AsenOsen opened this issue Sep 23, 2017 · 1 comment
Open

Is it possible to include library as NgModule? #16

AsenOsen opened this issue Sep 23, 2017 · 1 comment

Comments

@AsenOsen
Copy link

AsenOsen commented Sep 23, 2017

I am not using SystemJS, but I need to import library via NgModule annotation. This is what I got: "Please add a @NgModule annotation.":

import { YaCoreModuleForRoot }  from 'angular2-yandex-maps';

...

@NgModule({
  declarations: [

    AppComponent,

  ],
  imports: [

    YaCoreModuleForRoot,

    ...
  ],

  bootstrap: [AppComponent]
})
export class AppModule {

}

Error(from web console):

Uncaught Error: Unexpected value 'YaCoreModuleForRoot' imported by the module 'AppModule'. Please add a @NgModule annotation.
    at syntaxError (compiler.es5.js:1690)
    at compiler.es5.js:15382
    at Array.forEach (<anonymous>)
    at CompileMetadataResolver.webpackJsonp.../../../compiler/@angular/compiler.es5.js.CompileMetadataResolver.getNgModuleMetadata (compiler.es5.js:15365)
    at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler._loadModules (compiler.es5.js:26795)
    at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler._compileModuleAndComponents (compiler.es5.js:26768)
    at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler.compileModuleAsync (compiler.es5.js:26697)
    at PlatformRef_.webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef_._bootstrapModuleWithZone (core.es5.js:4536)
    at PlatformRef_.webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef_.bootstrapModule (core.es5.js:4522)
    at Object.../../../../../src/main.ts (main.ts:11)
@vanelizarov
Copy link

vanelizarov commented Nov 28, 2017

You can try this way:

import { YaCoreModule } from 'angular2-yandex-maps'

@NgModule({
  ...
  imports: [
    YaCoreModule.forRoot()
  ]
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants