【问题标题】:Routing in Chrome: HTTP Error 404.0 - Not FoundChrome 中的路由:HTTP 错误 404.0 - 未找到
【发布时间】:2016-06-23 11:50:59
【问题描述】:

我有以下代码,在除 chrome 之外的所有浏览器中都可以正常工作 在单击事件后的 chrome 中,它正在重定向,但我立即收到 HTTP 404-Not Found 问题

控制台中没有错误也删除了所有cookie和所有

调试的时候发现polyfill.js文件可能有问题,但是不知道具体原因和解决方法。

我的kms.html页面是起始页 在应用组件中

@Component({
    selector: 'app',
    template: '<router-outlet></router-outlet>',
    directives: [ROUTER_DIRECTIVES, loginComponent, globalFrameComponent],
    providers: [HTTP_PROVIDERS, ROUTER_PROVIDERS]
})
@RouteConfig([
    { path: '/', name: 'Login', component: loginComponent, useAsDefault: true },
    { path: '/kms', name: 'Kms', component: globalFrameComponent }

])
@Injectable()
export class AppComponent {
    constructor(private _router: Router) {
        this._router.navigate(['Login']);
    }

在登录组件中:

@Component({
    selector: 'login',
    templateUrl: 'login.html'

})
@Injectable()
export class loginComponent {
    constructor(private _router: Router) {

    }

    loginClick(): void {
        debugger;
        this._router.navigate(['Kms']);
    }

}

在那个 GlobalFrameCompnent 我有

@Component({
    selector: 'kms-app',
    templateUrl: 'app/dashboard/landing/html/globalframe.html',
    providers: [HTTP_PROVIDERS]

})
@Injectable()
export class globalFrameComponent {

//Code i.e properties and method required by view
}

也在 IE 中工作,仅在登录后在 Chrome 中我正在重定向但立即我得到 IIS 错误页面.. HTTP 错误 404.0 - 未找到

【问题讨论】:

标签: javascript google-chrome angular angular2-routing


【解决方案1】:

不要忘记 index.html 中的&lt;base href="/"&gt;

【讨论】:

    【解决方案2】:

    表单标签的问题,当我在“表单”标签中有内容时,它在 chrome 中不起作用。

    【讨论】:

      猜你喜欢
      • 2011-04-01
      • 2016-03-08
      • 2011-08-06
      • 1970-01-01
      • 1970-01-01
      • 2016-04-02
      • 2014-10-18
      • 1970-01-01
      • 2017-07-28
      相关资源
      最近更新 更多