问题的根本在于HashLocationStrategy的路由模式不兼容ActiveReportsJS Report Designer组件。解决这个问题的方法是使用PathLocationStrategy路由模式。下面是示例代码,展示如何在ASP.NET Boilerplate Angular应用中使用PathLocationStrategy:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { HttpClientModule } from '@angular/common/http';
import { LocationStrategy, PathLocationStrategy } from '@angular/common';
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
HttpClientModule,
AppRoutingModule
],
declarations: [
AppComponent
],
providers: [
{ provide: LocationStrategy, useClass: PathLocationStrategy }
],
bootstrap: [AppComponent]
})
export class AppModule {
}
import { Component, OnInit } from '@angular/core';
import { AppSessionService } from '@shared/common/session/app-session.service';
import { AppAuthService } from '@app/shared/common/auth/app-auth.service';
import { SignalRHelper } from '@shared/helpers/SignalRHelper';
import { ApplicationInfoDto, SessionServiceProxy } from '@shared/service-proxies/service-proxies';
import { Router } from '@angular/router';
import { TokenService } from '@abp/auth/token.service';
import { AppConsts } from '@shared/AppConsts';
@Component({
templateUrl: './app.component.html',
styleUrls: ['./app.component.less']
})
export class AppComponent implements OnInit {
private version: string;
private releaseDate: string;
isSessionExpired = false;
constructor(
public appSessionService: AppSessionService,
public authService: AppAuthService,
private _sessionService: SessionServiceProxy,
private _router: Router,
private _tokenService: TokenService
) {}