相关疑难解决方法(0)

Angular 2路由器没有基本href设置

我收到错误,找不到原因.这是错误:

EXCEPTION: Error during instantiation of LocationStrategy! (RouterOutlet -> Router -> Location -> LocationStrategy).
    angular2.dev.js:23514 EXCEPTION: Error during instantiation of LocationStrategy! (RouterOutlet -> Router -> Location -> LocationStrategy).BrowserDomAdapter.logError @ angular2.dev.js:23514BrowserDomAdapter.logGroup @ angular2.dev.js:23525ExceptionHandler.call @ angular2.dev.js:1145(anonymous function) @ angular2.dev.js:14801NgZone._notifyOnError @ angular2.dev.js:5796collection_1.StringMapWrapper.merge.onError @ angular2.dev.js:5700run @ angular2-polyfills.js:141(anonymous function) @ angular2.dev.js:5719zoneBoundFn @ angular2-polyfills.js:111lib$es6$promise$$internal$$tryCatch @ angular2-polyfills.js:1511lib$es6$promise$$internal$$invokeCallback @ angular2-polyfills.js:1523lib$es6$promise$$internal$$publish @ angular2-polyfills.js:1494(anonymous function) @ angular2-polyfills.js:243microtask @ angular2.dev.js:5751run @ angular2-polyfills.js:138(anonymous function) @ angular2.dev.js:5719zoneBoundFn @ angular2-polyfills.js:111lib$es6$promise$asap$$flush @ angular2-polyfills.js:1305
    angular2.dev.js:23514 ORIGINAL EXCEPTION: No base href set. Please provide a value for …
Run Code Online (Sandbox Code Playgroud)

routing angular

177
推荐指数
7
解决办法
15万
查看次数

Angular 2.0路由器无法重新加载浏览器

我使用的是Angular 2.0.0-alpha.30版本.当重定向到不同的路由,然后刷新浏览器,它显示无法GET /路由.

你能帮我弄清楚这个错误发生的原因吗?

angular2-routing angular

176
推荐指数
10
解决办法
10万
查看次数

Angular2路由器(@ angular/router),如何设置默认路由?

如何在@Routes路径元数据集合中设置默认路由?如果使用@ angular/router-deprecated中的angular2路由器,则在@routeConfig对象中定义路由,该对象是路由对象的集合,但这些路由对象具有更多属性.例如,它们具有'name'和'useAsDefualt'属性,而从@ angular/router定义的路由则没有.我想用新路由器编写我的新应用程序,但是如何使用新路由器并设置默认路由?

这是我的主要app组件,它定义了我的路线:

import { Component } from '@angular/core';
import { DashboardComponent } from './dashboard/dashboard.component';
import { ConfigManagerComponent } from './configManager/configManager.component';
import { ApplicationMgmtComponent } from './applicationMgmt/applicationMgmt.component';
import { MergeComponent } from './merge/merge.component';

import { ROUTER_DIRECTIVES, Routes } from '@angular/router';


@Component({
    selector: 'app-container',
    templateUrl: 'app/app.component.html',
    directives: [ROUTER_DIRECTIVES]
})

@Routes([

        { path: '/Dashboard', component: DashboardComponent },
        { path: '/ConfigManager', component: ConfigManagerComponent },
        { path: '/Merge', component: MergeComponent },
        { path: '/ApplicationManagement', component: ApplicationMgmtComponent }
])

export class AppComponent { } …
Run Code Online (Sandbox Code Playgroud)

angular

63
推荐指数
4
解决办法
10万
查看次数

标签 统计

angular ×3

angular2-routing ×1

routing ×1