Ich verwende Winkel für eine Weile. Heute habe ich auf rc1 aktualisiert und jetzt startet die Anwendung nicht mehr. folgte ich den Quickstart auf angular.io ...Boot-Anwendung RC0 mit
Das ist mein Index:
<!-- 1. Load libraries -->
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system-polyfills.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bower_components/moment/min/moment.min.js"></script>
<script src="bower_components/moment/locale/it.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
<script src="bower_components/bootstrap-material-design/dist/js/material.js"></script>
<script src="bower_components/toastr/toastr.min.js"></script>
<script src="bower_components/spin.js/spin.min.js"></script>
<script src="bower_components/inobounce/inobounce.min.js"></script>
<script src="app/source/utils/extensions.js"></script>
<!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script>
$.material.init();
System.import('app').catch(function(err){ console.error(err); });
</script>
Das ist mein system.config.js:
(function(global) {
// map tells the System loader where to look for things
var map = {
'app': 'app/source/', // 'dist',
'rxjs': 'node_modules/rxjs',
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
'@angular': 'node_modules/@angular'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { defaultExtension: 'js' },
};
var packageNames = [
'@angular/common',
'@angular/compiler',
'@angular/core',
'@angular/http',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/router-deprecated',
'@angular/testing',
'@angular/upgrade',
];
// add package entries for angular packages in the form '@angular/common': { main: 'index.js', defaultExtension: 'js' }
packageNames.forEach(function(pkgName) {
packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
});
var config = {
map: map,
packages: packages
}
// filterSystemConfig - index.html's chance to modify config before we register it.
if (global.filterSystemConfig) { global.filterSystemConfig(config); }
System.config(config);
})(this);
Und das ist meine dist-Ordner Struktur:
Mit diesem konfiguration wenn ich meine webapp eintrage bekomme ich folgenden fehler:
main:52 Error: SyntaxError: Unexpected token <(…)
Können Sie mir bitte helfen? Vielen Dank
EDIT Das Problem mit dem Router
EDIT Dies ist meine Komponente verwandt zu sein scheint:
import {Component, OnInit, OnDestroy} from '@angular/core';
import {RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS} from '@angular/router-deprecated';
import {HTTP_PROVIDERS} from '@angular/http';
import {MainComponent} from './components/sections/main.component';
import {LoginComponent} from './components/sections/login.component';
import {NotFoundComponent} from './components/sections/not-found.component';
import {EventEmitterService} from './services/event-emitter.service';
import {IdentityService} from './services/identity.service';
import {NavigationService, Routes} from './services/navigation.service';
import {SettingsService} from './services/settings.service';
import {ToastsService} from './services/toasts.service';
import {BaseHttpService} from './services/base/base-http.service';
import {LoadingService} from './services/loading.service';
import 'rxjs/Rx';
@Component({
selector: 'my-app',
template: '<router-outlet></router-outlet>',
directives: [ROUTER_DIRECTIVES],
providers: [ROUTER_PROVIDERS, EventEmitterService, NavigationService, SettingsService, ToastsService, HTTP_PROVIDERS, BaseHttpService, IdentityService, LoadingService]
})
@RouteConfig([
{path:Routes.Login.path , name: Routes.Login.state , component: LoginComponent , useAsDefault: true},
{path:Routes.Main.path , name: Routes.Main.state , component: MainComponent},
{path:Routes.NotFound.path , name: Routes.NotFound.state , component: NotFoundComponent},
{path:'/**' , redirectTo: [Routes.NotFound.state]}
])
export class AppComponent implements OnInit, OnDestroy
{
private unauthorizedSubscription:EventSubscription;
public constructor (private _identitySvc:IdentityService, private _eventEmitterSvc:EventEmitterService) {
debugger;
}
public ngOnInit()
{
this.unauthorizedSubscription = this._eventEmitterSvc.unauthorizedEvt.subscribe (() => this._identitySvc.logout());
}
public ngOnDestroy()
{
this.unauthorizedSubscription.unsubscribe();
}
}
Wenn ich es in etwa wie folgt bearbeiten:
import {Component, OnInit, OnDestroy} from '@angular/core';
@Component({
selector: 'my-app',
template: 'hello',
})
export class AppComponent implements OnInit, OnDestroy
{
private unauthorizedSubscription:EventSubscription;
public constructor() {
debugger;
}
}
Es funktioniert
vielleicht http://stackoverflow.com/questions/37000243/angular2-router-deprecated-dependencies-not-being-loaded/37000268#37000268? –
Ich habe bereits '@ angular/router-deprecated' hinzugefügt, aber leider löst das das Problem nicht. – user3471528
Entfernen * Import ‚rxjs/Rx‘; * es funktioniert, aber ich bekomme Fehler wie: * muObservable.finally ist keine Funktion * .. Ich habe beobachtbare importiert wie folgt aus: * Import {beobachtbare} von ‚rxjs/beobachtbar‘ * – user3471528