Reputation: 99
I have SharedService called DataService. Im trying to make that as Singleton. So I tried to bootstrap this in my app.module.ts like this
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
import { NativeScriptModule } from "nativescript-angular/platform";
import { NativeScriptFormsModule } from "nativescript-angular/forms";
import { NativeScriptHttpModule } from "nativescript-angular/http";
import { NativeScriptRouterModule } from "nativescript-angular/router";
import "reflect-metadata";
import { AppComponent } from "./app.component";
import {ArraysPipe} from "./arraypipe";
import { routes, navigatableComponents } from "./app.routing";
import { DataService } from "./services/passenger-list.services";
@NgModule({
declarations: [AppComponent,ArraysPipe,...navigatableComponents],
//providers:[DataService],
bootstrap: [AppComponent,[DataService]],
imports: [
NativeScriptModule,
NativeScriptFormsModule,
NativeScriptHttpModule,
NativeScriptRouterModule,
NativeScriptRouterModule.forRoot(routes)
],
schemas: [NO_ERRORS_SCHEMA]
})
export class AppModule { }
When I run , it is throwing me exception
Component DataService is not part of any NgModule or the module has not been imported into your module.
Please help!!!!
Upvotes: 0
Views: 63
Reputation: 12376
The error message states that Angular believes that DataService is a component because you have in the bootstrap property of the module.
Upvotes: 1