无法使用路由器插座加载/路由到HTML页面

时间:2016-06-22 10:12:27

标签: javascript typescript angular angularjs-routing

我正在尝试路由到主页面中的登录页面 主页是:KMS.html,它是这样的(跳过脚本和所有)

<html>
<body class="hold-transition skin-blue sidebar-mini">
    <router-outlet></router-outlet>
</body>
</html>

以下是该页面的应用程序组件

import {Component} from 'angular2/core';
import {Injectable} from 'angular2/core';
import {ROUTER_PROVIDERS, RouteConfig, ROUTER_DIRECTIVES, Router} from 'angular2/router';
import {HTTP_PROVIDERS, Http, Response} from 'angular2/http';
import 'rxjs/Rx';
import {globalFrameComponent} from './dashboard/landing/globalFrameComponent';
import {loginComponent} from '../login/loginComponent';
//import {HttpService} from './common/services/httpService';


@Component({
    templateUrl: 'ems.html',
    directives: [ROUTER_DIRECTIVES],
    providers: [HTTP_PROVIDERS, ROUTER_PROVIDERS]   //HttpService
})
@RouteConfig([
    { path: '/login', name: 'Login', component: loginComponent, useAsDefault: true },
    { path: '/somethingelse', name: 'EMS', component: globalComponent }

])
@Injectable()
export class AppComponent {
}

文件夹结构:

在Root中我有app文件夹,其中包含appComponent和main.js,登录文件夹包含登录组件,kms.html

我收到以下错误

  

http://localhost:50102/login/loginComponent

加载http://localhost:50102/app/appComponent.js为“../login/loginComponent”时出错

0 个答案:

没有答案