mirror of https://github.com/abpframework/abp.git
2 changed files with 24 additions and 2 deletions
@ -1,12 +1,21 @@ |
|||
import { ModuleWithProviders, NgModule } from '@angular/core'; |
|||
import { Injector, ModuleWithProviders, NgModule } from '@angular/core'; |
|||
import { NAVIGATE_TO_MANAGE_PROFILE } from '@abp/ng.core'; |
|||
import { ACCOUNT_ROUTE_PROVIDERS } from './providers/route.provider'; |
|||
import { navigateToManageProfileFactory } from './utils/factories'; |
|||
|
|||
@NgModule() |
|||
export class AccountConfigModule { |
|||
static forRoot(): ModuleWithProviders<AccountConfigModule> { |
|||
return { |
|||
ngModule: AccountConfigModule, |
|||
providers: [ACCOUNT_ROUTE_PROVIDERS], |
|||
providers: [ |
|||
ACCOUNT_ROUTE_PROVIDERS, |
|||
{ |
|||
provide: NAVIGATE_TO_MANAGE_PROFILE, |
|||
useFactory: navigateToManageProfileFactory, |
|||
deps: [Injector], |
|||
}, |
|||
], |
|||
}; |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,13 @@ |
|||
import { Injector } from '@angular/core'; |
|||
import { RoutesService } from '@abp/ng.core'; |
|||
import { Router } from '@angular/router'; |
|||
import { eAccountRouteNames } from '../enums/route-names'; |
|||
|
|||
export function navigateToManageProfileFactory(injector: Injector) { |
|||
return () => { |
|||
const router = injector.get(Router); |
|||
const routes = injector.get(RoutesService); |
|||
const { path } = routes.find(item => item.name === eAccountRouteNames.ManageProfile); |
|||
router.navigateByUrl(path); |
|||
}; |
|||
} |
|||
Loading…
Reference in new issue