2016-11-26 3 views
0

Ich versuche, eine sehr einfache nativescript/angular2 App zu starten, scheint es gut zu bauen, aber nachdem die App auf den Android (Genymotion) Emulator bereitgestellt wird, bekomme ich die folgende Fehlermeldung. So scheint es, dass angular nicht bootstrapped ist ??? nicht sicher, warum das ist ... Irgendeine Idee, was ich falsch mache?Nativescript/angular2: kein Provider für applicationRef! Fehler nach der Bereitstellung

Fehlermeldung:

"@angular/core": "2.1.2", 
"@angular/forms": "2.1.2", 
    "@angular/http": "2.1.2", 
    "@angular/platform-browseBUILD SUCCESSFUL 

Total time: 1 mins 39.836 secs 
Project successfully built 
Successfully deployed on device with identifier '192.168.8.101:5555'. 
JS: ns-renderer: ERROR BOOTSTRAPPING ANGULAR 
JS: ns-renderer: No provider for ApplicationRef! 
JS: 
JS: Error: No provider for ApplicationRef! 
JS:  at NoProviderError.Error (native) 
JS:  at NoProviderError.BaseError [as constructor] (/data/data/org.nativescript.barcodescanner/files/app/tns_modules/@angular/core/bundles/core.umd.js:1104:38) 
JS:  at NoProviderError.AbstractProviderError [as constructor] (/data/data/org.nativescript.barcodescanner/files/app/tns_modules/@angular/core/bundles/core.umd.js:1235:20) 
JS:  at new NoProviderError (/data/data/org.nativescript.barcodescanner/files/app/tns_modules/@angular/core/bundles/core.umd.js:1266:20) 
JS:  at ReflectiveInjector_._throwOrNull (/data/data/org.nativescript.barcodescanner/files/app/tns_modules/@angular/core/bundles/core.umd.js:2906:23) 
JS:  at ReflectiveInjector_._getByKeyDefault (/data/data/org.nativescript.barcodescanner/files/app/tns_modules/@angular/core/bundles/core.umd.js:2934:29) 
JS:  at ReflectiveInjector_._getByKey (/data/data/org.nativescript.barcodescanner/files/app/tns_modules/@angular/core/bundles/core.umd.js:2897:29) 
JS:  at ReflectiveInjector_.get (/data/data/org.nativescript.barcodescanner/files/app/tns_modules/@angular/core/bundles/core.umd.js:2706:25) 
JS:  at NgModuleInjector.Object.defineProperty.get (/AppModule/module.ngfactory.js:58:87) 
JS:  at NgModuleInjector.AppModuleInjector.createInternal (/AppModule/module.ngfactory.js:83:60) 

Meine main.ts Datei, wenn das hilft:

import { platformNativeScriptDynamic } from "nativescript-angular/platform"; 


import { AppModule } from "./app.module"; 



platformNativeScriptDynamic().bootstrapModule(AppModule); 

und meine app.module.ts:

import { NgModule } from "@angular/core"; 
import { NativeScriptFormsModule } from "nativescript-angular/forms"; 
import { NativeScriptModule } from "nativescript-angular/platform"; 
import { NativeScriptRouterModule } from "nativescript-angular/router"; 

import { AppComponent } from "./app.component"; 
import {routes, navigatableComponents } from "./app.routing"; 

@NgModule({ 
    imports : [(
    NativeScriptModule, NativeScriptFormsModule, NativeScriptRouterModule, NativeScriptRouterModule.forRoot(routes) 
    )], 
    declarations : [AppComponent, ...navigatableComponents 
    ], 
    bootstrap : [AppComponent]  
}) 
export class AppModule {} 

Antwort

0

die Klammer entfernen von Ihrem imports in , sollte es eine Reihe von Modulen sein. wie folgt:

@NgModule({ 
    imports : [ 
    NativeScriptModule, NativeScriptFormsModule, NativeScriptRouterModule, NativeScriptRouterModule.forRoot(routes) 
    ], 
    declarations : [AppComponent, ...navigatableComponents ], 
    bootstrap : [AppComponent]  
}) 
+0

Nochmals vielen Dank @HabibKazemi – user2094257

Verwandte Themen