mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-17 07:50:12 +01:00
parent
0beef0b8a9
commit
ec0e5aa673
5 changed files with 20 additions and 21 deletions
|
|
@ -20,7 +20,7 @@ const HMR = helpers.hasProcessFlag('hot');
|
|||
const METADATA = {
|
||||
title: 'ng2-admin - Angular 2 Admin Template',
|
||||
description: 'Free Angular 2 and Bootstrap 4 Admin Template',
|
||||
baseUrl: './',
|
||||
baseUrl: '/',
|
||||
isDevServer: helpers.isWebpackDevServer()
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,9 @@ module.exports = function(options) {
|
|||
devServer: {
|
||||
port: METADATA.port,
|
||||
host: METADATA.host,
|
||||
historyApiFallback: true,
|
||||
historyApiFallback: {
|
||||
index: '/index.html'
|
||||
},
|
||||
watchOptions: {
|
||||
aggregateTimeout: 300,
|
||||
poll: 1000
|
||||
|
|
@ -172,4 +174,4 @@ module.exports = function(options) {
|
|||
}
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -245,20 +245,18 @@ export const PAGES_MENU = [
|
|||
},
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
path: ['/login'],
|
||||
data: {
|
||||
menu: {
|
||||
title: 'Login',
|
||||
url: '#/login'
|
||||
title: 'Login'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
path: ['/register'],
|
||||
data: {
|
||||
menu: {
|
||||
title: 'Register',
|
||||
url: '#/register'
|
||||
title: 'Register'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,8 +76,12 @@ export class BaMenuService {
|
|||
}
|
||||
|
||||
// we have to collect all paths to correctly build the url then
|
||||
item.route.paths = parent && parent.route && parent.route.paths ? parent.route.paths.slice(0) : [];
|
||||
item.route.paths.push(item.route.path);
|
||||
if (Array.isArray(item.route.path)) {
|
||||
item.route.paths = item.route.path;
|
||||
} else {
|
||||
item.route.paths = parent && parent.route && parent.route.paths ? parent.route.paths.slice(0) : ['/'];
|
||||
item.route.paths.push(item.route.path);
|
||||
}
|
||||
|
||||
if (object.children && object.children.length > 0) {
|
||||
item.children = this._convertArrayToItems(object.children, item);
|
||||
|
|
@ -95,10 +99,6 @@ export class BaMenuService {
|
|||
|
||||
protected _prepareItem(object:any):any {
|
||||
if (!object.skip) {
|
||||
|
||||
let itemUrl = this._router.serializeUrl(this._router.createUrlTree(object.route.paths));
|
||||
object.url = object.url ? object.url : '#' + itemUrl;
|
||||
|
||||
object.target = object.target || '';
|
||||
object.pathMatch = object.pathMatch || 'full';
|
||||
return this._selectItem(object);
|
||||
|
|
@ -108,11 +108,7 @@ export class BaMenuService {
|
|||
}
|
||||
|
||||
protected _selectItem(object:any):any {
|
||||
if (object.children || object.pathMatch === 'full') {
|
||||
object.selected = object.url === ('#' + this._router.url);
|
||||
} else {
|
||||
object.selected = ('#' + this._router.url).indexOf(object.url) === 0;
|
||||
}
|
||||
object.selected = this._router.isActive(this._router.createUrlTree(object.route.paths), object.pathMatch !== 'full');
|
||||
return object;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
<li *ngIf="!menuItem.hidden" [title]="menuItem.title" [ngClass]="{'al-sidebar-list-item': !child, 'ba-sidebar-sublist-item': child, 'selected': menuItem.selected && !menuItem.expanded, 'with-sub-menu': menuItem.children, 'ba-sidebar-item-expanded': menuItem.expanded}">
|
||||
|
||||
<a *ngIf="!menuItem.children && !menuItem.url" (mouseenter)="onHoverItem($event, item)" [routerLink]="menuItem.route.paths" class="al-sidebar-list-link">
|
||||
<i *ngIf="menuItem.icon" class="{{ menuItem.icon }}"></i><span>{{ menuItem.title }}</span>
|
||||
</a>
|
||||
|
||||
<a *ngIf="!menuItem.children" (mouseenter)="onHoverItem($event, item)" [href]="menuItem.url" [target]="menuItem.target" class="al-sidebar-list-link">
|
||||
<a *ngIf="!menuItem.children && menuItem.url" (mouseenter)="onHoverItem($event, item)" [href]="menuItem.url" [target]="menuItem.target" class="al-sidebar-list-link">
|
||||
<i *ngIf="menuItem.icon" class="{{ menuItem.icon }}"></i><span>{{ menuItem.title }}</span>
|
||||
</a>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue