无法读取Angular RC3

时间:2016-07-22 10:25:59

标签: javascript angular migration

我在RC3上收到此错误,我试图将我的项目逐渐从发布迁移到另一个,我在RC1上也有同样的意思我忽略了它,我假设它将在升级到RC3后修复,这是我的实际package.json内容:

{
  "name": "angular2-quickstart",
  "version": "1.0.0",
  "scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
    "lite": "lite-server",
    "postinstall": "typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings"
  },
  "license": "ISC",
  "dependencies": {

    "@angular/compiler": "2.0.0-rc.3",
    "@angular/core": "2.0.0-rc.3",
    "@angular/common": "2.0.0-rc.3",
    "@angular/forms": "^0.1.0",

    "@angular/http": "2.0.0-rc.3",
    "@angular/platform-browser": "2.0.0-rc.3",
    "@angular/platform-browser-dynamic": "2.0.0-rc.3",
    "@angular/router":  "3.0.0-alpha.8",
    "@angular/router-deprecated":  "2.0.0-rc.2",
    "es6-shim": "0.35.1",
    "es6-promise": "3.2.1",

    "reflect-metadata": "0.1.3",
    "rxjs": "5.0.0-beta.6",
    "systemjs": "0.19.26",
    "zone.js": "0.6.12"
  },
  "devDependencies": {
    "concurrently": "^2.0.0",
    "lite-server": "^2.2.0",
    "typescript": "^1.8.10",
    "typings":"^0.8.1"
  }
}

以下是错误的屏幕截图:

ScreenShot

我的app组件ts:

@Component({
    selector: 'my-app',
    template: `
    <navbar></navbar>

    <div class="container">
        <router-outlet></router-outlet>
    </div>
    `,
    directives:[NavBarComponent, ROUTER_DIRECTIVES],
    providers:[PostService, HTTP_PROVIDERS]

})
export class AppComponent implements OnInit  { 

  static home;

constructor(private _postService: PostService){
  } 

 ngOnInit(){

this._postService.getConf("conf/conf.json")

   .subscribe(res =>{
      var home = res;

      AppComponent.home = home.url;
 }

 );
     }

它应该加载我的主页它是一个简单的欢迎字符串:

import {Component, OnInit} from '@angular/core';

@Component({

    template:`<br><h1>Bienvenue</h1>`
})
export class HomeComponent{

}

我的路线:

import {provideRouter, RouterConfig} from '@angular/router';
import {HomeComponent} from './components/home.component';
import {ActionsComponent} from './components/actions.component';
import {TasksComponent} from './components/tasks.component';
import {DetailsComponent} from './components/details.component';
import {ActionFormComponent} from './forms/action-form.component';
import {TaskFormComponent} from './forms/task-form.component';
import {ActionViewFormComponent} from './forms/action-view-form.component';
import {TaskViewFormComponent} from './forms/task-view-form.component';


    export const appRoutes: RouterConfig = [

        {path:'', component:HomeComponent},

        {path:'actions',component:ActionsComponent},
        {path:'actions/:id',component:ActionFormComponent},
        {path:'actions/new', component:ActionFormComponent},
        {path:'actionview',component:ActionViewFormComponent},

        {path:'tasks',component:TasksComponent},
        {path:'tasks/:id',component:TaskFormComponent},
        {path:'tasks/new', component:TaskFormComponent},
        {path:'taskview',component:TaskViewFormComponent},

        {path:'*other',component:HomeComponent}

];

export const APP_ROUTER_PROVIDER = provideRouter(appRoutes);

0 个答案:

没有答案