Angular 2 应用升级到 2.0.0-rc.1 后失败

Angular 2 App failed after upgrade to 2.0.0-rc.1

我试图将我的项目更新到 2.0.0-rc.1 但得到了这个异常,我无法弄清楚为什么......在我 运行 ng 服务之后,我没有得到任何错误并且在我的dist 文件夹 /vendor/@angular/router-deprecated 存在.. 知道我做错了什么吗?

"http://localhost:4200/vendor/@angular/router-deprecated Failed to load resource: the server responded with a status of 404 (Not Found)
zone.js:461 Unhandled Promise rejection: Error: XHR error (404 Not Found) loading http://localhost:4200/vendor/@angular/router-deprecated
        at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:4200/vendor/zone.js/dist/zone.js:769:30)
        at ZoneDelegate.invokeTask (http://localhost:4200/vendor/zone.js/dist/zone.js:356:38)
        at Zone.runTask (http://localhost:4200/vendor/zone.js/dist/zone.js:256:48)
        at XMLHttpRequest.ZoneTask.invoke (http://localhost:4200/vendor/zone.js/dist/zone.js:423:34)
    Error loading http://localhost:4200/vendor/@angular/router-deprecated as "@angular/router-deprecated" from http://localhost:4200/app/account.js ; Zone: <root> ; Task: Promise.then ; Value: Error: Error: XHR error (404 Not Found) loading http://localhost:4200/vendor/@angular/router-deprecated(…)consoleError @ zone.js:461
zone.js:463 Error: Uncaught (in promise): Error: Error: XHR error (404 Not Found) loading http://localhost:4200/vendor/@angular/router-deprecated(…)consoleError @ zone.js:463
http://localhost:4200/vendor/@angular/router-deprecated Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:4200/traceur Failed to load resource: the server responded with a status of 404 (Not Found)"

这是我做路由的地方:

import {Component, provide, Optional, Inject, NgZone} from '@angular/core';
import {RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS} from '@angular/router-deprecated';
/*import {CliRouteConfig} from './route-config';*/


import {BgtPulseRegisterSimple} from './register-simple/register-simple';
import {BgtPulseLogin} from './login/login';

@Component({
  selector: 'account-app',
  providers: [
    ROUTER_PROVIDERS,
    provide('UserService', { useClass: UserService }),
    provide('NotificationService', { useClass: NotificationServiceMock }),
    provide('RoutingService', { useClass: RoutingServiceMock })
  ],
  template: `
    <h2>Account</h2>
    <nav>
      <a [routerLink]="['Login']" class="nav-login">Login</a>
      <a [routerLink]="['RegisterSimple']" class="nav-register-simple">Register Simple</a>

    </nav>
    <hr>
    <div style="margin:20px; border:1px solid #ccc;">
      <router-outlet></router-outlet>
    </div>
  `,
  directives: [ROUTER_DIRECTIVES, RegisterSimple, FormElements],
  pipes: []
})

@RouteConfig([
  { path: '/login', name: 'Login', component: Login },
  { path: '/register-simple', name: 'RegisterSimple', component: RegisterSimple }

])


export class AccountApp {

  private userStore: any;
  private userState: any = null;

  constructor(
    private ngZone: NgZone,
    @Optional() @Inject('UserStore') UserStore: any
  ) {
    let userData = {
      general: {
        userNodeID: 123,
        username: 'Max.m',
        firstname: 'Max',
        lastname: 'Mustermann',
        salutation: 'Mr',
        birthdate: '23.12.1988'
      },
      address: {
        street: 'Musterstraße',
        houseNumber: '4',
        postCode: '4020',
        city: 'Linz',
        countryCode: 'AT'
      },
      contact: {
        phone: '0123456789',
        email: 'max@mustermann.at',
        newsletter: true
      },
      payment: {
        accountHolderName: 'Max Mustermann',
        bic: 'AT65232323',
        iban: 'AT9837272727272'
      },
      culture: {
        currency: 'EUR',
        language: 'de',
        oddFormat: 'Decimal'
      }
    }

    this.userStore = UserStore;

    this.ngZone.runOutsideAngular(() => {
      this.ngZone.run(() => {
        this.userStore.dispatch({ type: 'USER_LOGIN', data: userData });
      });
    });
  }
}

我相信不再支持 router-deprecated.....

经过一些阅读后,我设法使用 "angular-cli": "1.0.0-beta.6"

让我的路线开始工作

这个 article 帮我弄明白了...它和我以前做的完全不同

希望对您有所帮助