Ich bin neu bei angularjs und entwickelte eine Demo-Anwendung mit angular2. Ich bekomme den folgenden Fehler beim Ausführen der Anwendung. Obwohl der folgende Fehler 404 sagt, wenn ich dieselbe URL (dh http://localhost:4679/Binder/CustomerModuleLibrary) auf den Browser mit der Erweiterung .js triff, wird das Skript in den Browser geladen.Fehler: XHR-Fehler (404 nicht gefunden) in Angular2-Anwendung
Here is the error:
Error: Error: XHR error (404 Not Found) loading http://localhost:4679/Binder/CustomerModuleLibrary
at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:4679/node_modules/zone.js/dist/zone.js:698:29)
at ZoneDelegate.invokeTask (http://localhost:4679/node_modules/zone.js/dist/zone.js:265:35)
at Zone.runTask (http://localhost:4679/node_modules/zone.js/dist/zone.js:154:47)
at XMLHttpRequest.ZoneTask.invoke (http://localhost:4679/node_modules/zone.js/dist/zone.js:335:33)
Error loading http://localhost:4679/Binder/CustomerModuleLibrary as "./CustomerModuleLibrary" from http://localhost:4679/UI/startup/../../Binder/Startup.js
-Code für CustomerModuleLibrary.ts
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {CustomerComponent} from './CustomerComponent';
import {FormsModule} from '@angular/forms'
@NgModule({
imports: [BrowserModule,FormsModule],
declarations: [CustomerComponent],
bootstrap: [CustomerComponent]
})
export class CustomerModuleLibrary { }
-Code für Startup.ts
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {CustomerModuleLibrary} from './CustomerModuleLibrary';
const platform = platformBrowserDynamic();
platform.bootstrapModule(CustomerModuleLibrary);
In der systemjs.config.js Datei
packages: {
app: {
main: '../../Binder/Startup.js',
defaultExtension: 'js'
},
rxjs: {
defaultExtension: 'js'
},
Auch sollte Ich führe npm Start vor dem Ausführen der App Lizenzierung?
ist das Problem mit fehlerhafter Konfiguration von 'system.config.js', zeigen Sie Ihre vollständige Verzeichnisstruktur –
AngularProject hat 3 Ordner 1. Binder 1a. CustomerComponent.ts 1b.CustomerModuleLibrary.ts 1c.Statuup.ts 2.Modell 2a.Customer.ts 3.UI 3a. Customet.html 3b.Master.html 4.System.config.js – Learner
Ich kann Ihnen helfen, wenn Sie mit Ihrem Projekt-Setup entweder einen Plot- oder Github-Repo erstellen –