diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1cc01946..286fd885 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,8 @@
### [@coreui/angular](https://coreui.io/) changelog
+##### `v2.4.2`
+- feat(header): use routerLink for brand instead of href attribute #51 - thanks @Hagith
+
##### `v2.4.1`
- fix(sidebar-nav): ie issues
diff --git a/dist/@coreui/angular/bundles/coreui-angular.umd.js b/dist/@coreui/angular/bundles/coreui-angular.umd.js
index 1b5836b7..1a77c845 100644
--- a/dist/@coreui/angular/bundles/coreui-angular.umd.js
+++ b/dist/@coreui/angular/bundles/coreui-angular.umd.js
@@ -985,7 +985,9 @@
this.renderer = renderer;
this.hostElement = hostElement;
this.navbarBrandText = { icon: '🅲', text: '🅲 CoreUI' };
- this.navbarBrandHref = '';
+ this.navbarBrandHref = ''; // deprecated, use navbarBrandRouterLink instead
+ // deprecated, use navbarBrandRouterLink instead
+ this.navbarBrandRouterLink = '';
this.fixedClass = 'header-fixed';
renderer.addClass(hostElement.nativeElement, 'app-header');
renderer.addClass(hostElement.nativeElement, 'navbar');
@@ -999,6 +1001,7 @@
function () {
this.isFixed(this.fixed);
this.navbarBrandImg = Boolean(this.navbarBrand || this.navbarBrandFull || this.navbarBrandMinimized);
+ this.navbarBrandRouterLink = this.navbarBrandRouterLink[0] ? this.navbarBrandRouterLink : this.navbarBrandHref;
};
/**
* @return {?}
@@ -1028,7 +1031,7 @@
AppHeaderComponent.decorators = [
{ type: core.Component, args: [{
selector: 'app-header, cui-header',
- template: "\r\n \r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n \r\n\r\n\r\n\r\n \r\n\r\n\r\n \r\n\r\n"
+ template: "\r\n \r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n \r\n\r\n\r\n\r\n \r\n\r\n\r\n \r\n\r\n"
}] }
];
/** @nocollapse */
@@ -1046,6 +1049,7 @@
navbarBrandMinimized: [{ type: core.Input }],
navbarBrandText: [{ type: core.Input }],
navbarBrandHref: [{ type: core.Input }],
+ navbarBrandRouterLink: [{ type: core.Input }],
sidebarToggler: [{ type: core.Input }],
mobileSidebarToggler: [{ type: core.Input }],
asideMenuToggler: [{ type: core.Input }],
@@ -1065,6 +1069,7 @@
{ type: core.NgModule, args: [{
imports: [
common.CommonModule,
+ router.RouterModule,
LayoutModule
],
exports: [
diff --git a/dist/@coreui/angular/bundles/coreui-angular.umd.js.map b/dist/@coreui/angular/bundles/coreui-angular.umd.js.map
index c38c867e..012a87bf 100644
--- a/dist/@coreui/angular/bundles/coreui-angular.umd.js.map
+++ b/dist/@coreui/angular/bundles/coreui-angular.umd.js.map
@@ -1 +1 @@
-{"version":3,"file":"coreui-angular.umd.js.map","sources":["ng://@coreui/angular/lib/shared/classes.ts","ng://@coreui/angular/lib/shared/toggle-classes.ts","ng://@coreui/angular/lib/shared/layout/layout.directive.ts","ng://@coreui/angular/lib/shared/layout/layout.module.ts","ng://@coreui/angular/lib/shared/replace.ts","ng://@coreui/angular/lib/aside/app-aside.component.ts","ng://@coreui/angular/lib/aside/app-aside.module.ts","ng://@coreui/angular/lib/breadcrumb/app-breadcrumb.service.ts","ng://@coreui/angular/lib/breadcrumb/app-breadcrumb.component.ts","ng://@coreui/angular/lib/breadcrumb/cui-breadcrumb.component.ts","ng://@coreui/angular/lib/breadcrumb/app-breadcrumb.module.ts","ng://@coreui/angular/lib/footer/app-footer.component.ts","ng://@coreui/angular/lib/footer/app-footer.module.ts","ng://@coreui/angular/lib/header/app-header.component.ts","ng://@coreui/angular/lib/header/app-header.module.ts","ng://@coreui/angular/lib/sidebar/app-sidebar.component.ts","ng://@coreui/angular/lib/sidebar/app-sidebar-footer.component.ts","ng://@coreui/angular/lib/sidebar/app-sidebar-form.component.ts","ng://@coreui/angular/lib/sidebar/app-sidebar-header.component.ts","ng://@coreui/angular/lib/sidebar/app-sidebar-minimizer.component.ts","ng://@coreui/angular/lib/sidebar/app-sidebar-nav.directive.ts","ng://@coreui/angular/lib/sidebar/app-sidebar-nav.component.ts","ng://@coreui/angular/lib/sidebar/app-sidebar-nav/app-sidebar-nav-divider.component.ts","ng://@coreui/angular/lib/sidebar/app-sidebar-nav.service.ts","ng://@coreui/angular/lib/sidebar/app-sidebar-nav/app-sidebar-nav-dropdown.component.ts","ng://@coreui/angular/lib/sidebar/app-sidebar-nav/app-sidebar-nav-items.component.ts","ng://@coreui/angular/lib/sidebar/app-sidebar-nav/app-sidebar-nav-link.component.ts","ng://@coreui/angular/lib/sidebar/app-sidebar-nav/app-sidebar-nav-title.component.ts","ng://@coreui/angular/lib/sidebar/app-sidebar-nav/app-sidebar-nav-label.component.ts","ng://@coreui/angular/lib/sidebar/app-sidebar.module.ts"],"sourcesContent":["export const sidebarCssClasses: Array = [\r\n 'sidebar-show',\r\n 'sidebar-sm-show',\r\n 'sidebar-md-show',\r\n 'sidebar-lg-show',\r\n 'sidebar-xl-show'\r\n];\r\n\r\nexport const asideMenuCssClasses: Array = [\r\n 'aside-menu-show',\r\n 'aside-menu-sm-show',\r\n 'aside-menu-md-show',\r\n 'aside-menu-lg-show',\r\n 'aside-menu-xl-show'\r\n];\r\n","import {Inject, Injectable, Renderer2} from '@angular/core';\r\nimport {DOCUMENT} from '@angular/common';\r\n\r\nconst RemoveClasses = (NewClassNames) => {\r\n const MatchClasses = NewClassNames.map((Class) => document.body.classList.contains(Class));\r\n return MatchClasses.indexOf(true) !== -1;\r\n};\r\n\r\nexport const ToggleClasses = (Toggle, ClassNames) => {\r\n const Level = ClassNames.indexOf(Toggle);\r\n const NewClassNames = ClassNames.slice(0, Level + 1);\r\n\r\n if (RemoveClasses(NewClassNames)) {\r\n NewClassNames.map((Class) => document.body.classList.remove(Class));\r\n } else {\r\n document.body.classList.add(Toggle);\r\n }\r\n};\r\n\r\n@Injectable()\r\nexport class ClassToggler {\r\n\r\n constructor(\r\n @Inject(DOCUMENT) private document: any,\r\n private renderer: Renderer2,\r\n ) {}\r\n\r\n removeClasses(NewClassNames) {\r\n const MatchClasses = NewClassNames.map((Class) => this.document.body.classList.contains(Class));\r\n return MatchClasses.indexOf(true) !== -1;\r\n }\r\n\r\n toggleClasses(Toggle, ClassNames) {\r\n const Level = ClassNames.indexOf(Toggle);\r\n const NewClassNames = ClassNames.slice(0, Level + 1);\r\n\r\n if (this.removeClasses(NewClassNames)) {\r\n NewClassNames.map((Class) => this.renderer.removeClass(this.document.body, Class));\r\n } else {\r\n this.renderer.addClass(this.document.body, Toggle);\r\n }\r\n }\r\n}\r\n","import {Directive, ElementRef, HostListener, Inject, Input, OnInit, Renderer2} from '@angular/core';\r\nimport {DOCUMENT} from '@angular/common';\r\n\r\nimport { asideMenuCssClasses, sidebarCssClasses } from '../classes';\r\nimport { ClassToggler } from '../toggle-classes';\r\n\r\n/**\r\n* Allows the sidebar to be toggled via click.\r\n*/\r\n@Directive({\r\n selector: '[appSidebarToggler]',\r\n providers: [ClassToggler]\r\n})\r\nexport class SidebarToggleDirective implements OnInit {\r\n @Input('appSidebarToggler') breakpoint: string;\r\n public bp;\r\n constructor(private classToggler: ClassToggler) {}\r\n ngOnInit(): void {\r\n this.bp = this.breakpoint;\r\n }\r\n @HostListener('click', ['$event'])\r\n toggleOpen($event: any) {\r\n $event.preventDefault();\r\n const cssClass = this.bp ? `sidebar-${this.bp}-show` : sidebarCssClasses[0];\r\n this.classToggler.toggleClasses(cssClass, sidebarCssClasses);\r\n }\r\n}\r\n\r\n@Directive({\r\n selector: '[appSidebarMinimizer]'\r\n})\r\nexport class SidebarMinimizeDirective {\r\n constructor(\r\n @Inject(DOCUMENT) private document: any,\r\n private renderer: Renderer2,\r\n ) { }\r\n\r\n @HostListener('click', ['$event'])\r\n toggleOpen($event: any) {\r\n $event.preventDefault();\r\n const body = this.document.body;\r\n body.classList.contains('sidebar-minimized') ?\r\n this.renderer.removeClass(body, 'sidebar-minimized') :\r\n this.renderer.addClass(body, 'sidebar-minimized');\r\n }\r\n}\r\n\r\n@Directive({\r\n selector: '[appMobileSidebarToggler]'\r\n})\r\nexport class MobileSidebarToggleDirective {\r\n constructor(\r\n @Inject(DOCUMENT) private document: any,\r\n private renderer: Renderer2,\r\n ) { }\r\n\r\n @HostListener('click', ['$event'])\r\n toggleOpen($event: any) {\r\n $event.preventDefault();\r\n const body = this.document.body;\r\n body.classList.contains('sidebar-show') ?\r\n this.renderer.removeClass(body, 'sidebar-show') :\r\n this.renderer.addClass(body, 'sidebar-show');\r\n }\r\n}\r\n\r\n/**\r\n* Allows the off-canvas sidebar to be closed via click.\r\n*/\r\n@Directive({\r\n selector: '[appSidebarClose]'\r\n})\r\nexport class SidebarOffCanvasCloseDirective {\r\n constructor(\r\n @Inject(DOCUMENT) private document: any,\r\n private renderer: Renderer2,\r\n ) { }\r\n\r\n @HostListener('click', ['$event'])\r\n toggleOpen($event: any) {\r\n $event.preventDefault();\r\n\r\n const body = this.document.body;\r\n if (body.classList.contains('sidebar-off-canvas')) {\r\n body.classList.contains('sidebar-show') ?\r\n this.renderer.removeClass(body, 'sidebar-show') :\r\n this.renderer.addClass(body, 'sidebar-show');\r\n }\r\n }\r\n}\r\n\r\n@Directive({\r\n selector: '[appBrandMinimizer]'\r\n})\r\nexport class BrandMinimizeDirective {\r\n constructor(\r\n @Inject(DOCUMENT) private document: any,\r\n private renderer: Renderer2,\r\n ) { }\r\n\r\n @HostListener('click', ['$event'])\r\n toggleOpen($event: any) {\r\n $event.preventDefault();\r\n const body = this.document.body;\r\n body.classList.contains('brand-minimized') ?\r\n this.renderer.removeClass(body, 'brand-minimized') :\r\n this.renderer.addClass(body, 'brand-minimized');\r\n }\r\n}\r\n\r\n\r\n/**\r\n* Allows the aside to be toggled via click.\r\n*/\r\n@Directive({\r\n selector: '[appAsideMenuToggler]',\r\n providers: [ClassToggler]\r\n})\r\nexport class AsideToggleDirective implements OnInit {\r\n @Input('appAsideMenuToggler') breakpoint: string;\r\n public bp;\r\n constructor(private classToggler: ClassToggler) {}\r\n ngOnInit(): void {\r\n this.bp = this.breakpoint;\r\n }\r\n @HostListener('click', ['$event'])\r\n toggleOpen($event: any) {\r\n $event.preventDefault();\r\n const cssClass = this.bp ? `aside-menu-${this.bp}-show` : asideMenuCssClasses[0];\r\n this.classToggler.toggleClasses(cssClass, asideMenuCssClasses);\r\n }\r\n}\r\n\r\n@Directive({\r\n selector: '[appHtmlAttr]'\r\n})\r\nexport class HtmlAttributesDirective implements OnInit {\r\n @Input() appHtmlAttr: {[key: string]: string };\r\n\r\n constructor(\r\n private renderer: Renderer2,\r\n private el: ElementRef\r\n ) {}\r\n\r\n ngOnInit() {\r\n const attribs = this.appHtmlAttr;\r\n for (const attr in attribs) {\r\n if (attr === 'style' && typeof(attribs[attr]) === 'object' ) {\r\n this.setStyle(attribs[attr]);\r\n } else if (attr === 'class') {\r\n this.addClass(attribs[attr]);\r\n } else {\r\n this.setAttrib(attr, attribs[attr]);\r\n }\r\n }\r\n }\r\n\r\n private setStyle(styles) {\r\n for (const style in styles) {\r\n this.renderer.setStyle(this.el.nativeElement, style, styles[style] );\r\n }\r\n }\r\n\r\n private addClass(classes) {\r\n const classArray = (Array.isArray(classes) ? classes : classes.split(' '));\r\n classArray.filter((element) => element.length > 0).forEach(element => {\r\n this.renderer.addClass(this.el.nativeElement, element );\r\n });\r\n }\r\n\r\n private setAttrib(key, value) {\r\n this.renderer.setAttribute(this.el.nativeElement, key, value );\r\n }\r\n}\r\n","import { CommonModule } from '@angular/common';\r\nimport { NgModule} from '@angular/core';\r\nimport {\r\n AsideToggleDirective,\r\n BrandMinimizeDirective,\r\n MobileSidebarToggleDirective,\r\n SidebarToggleDirective,\r\n SidebarMinimizeDirective,\r\n SidebarOffCanvasCloseDirective,\r\n HtmlAttributesDirective\r\n} from './layout.directive';\r\nimport { ClassToggler } from '../toggle-classes';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule\r\n ],\r\n exports: [\r\n AsideToggleDirective,\r\n BrandMinimizeDirective,\r\n MobileSidebarToggleDirective,\r\n SidebarToggleDirective,\r\n SidebarMinimizeDirective,\r\n SidebarOffCanvasCloseDirective,\r\n HtmlAttributesDirective\r\n ],\r\n declarations: [\r\n AsideToggleDirective,\r\n BrandMinimizeDirective,\r\n MobileSidebarToggleDirective,\r\n SidebarToggleDirective,\r\n SidebarMinimizeDirective,\r\n SidebarOffCanvasCloseDirective,\r\n HtmlAttributesDirective\r\n ],\r\n providers: [\r\n ClassToggler\r\n ]\r\n})\r\nexport class LayoutModule { }\r\n","export function Replace(el: any): any {\r\n const nativeElement: HTMLElement = el.nativeElement;\r\n const parentElement: HTMLElement = nativeElement.parentElement;\r\n // move all children out of the element\r\n while (nativeElement.firstChild) {\r\n parentElement.insertBefore(nativeElement.firstChild, nativeElement);\r\n }\r\n // remove the empty element(the host)\r\n parentElement.removeChild(nativeElement);\r\n}\r\n","import {Component, ElementRef, Input, OnInit, OnDestroy, Inject, Renderer2} from '@angular/core';\r\nimport {DOCUMENT} from '@angular/common';\r\n\r\nimport { asideMenuCssClasses } from '../shared';\r\n\r\n@Component({\r\n selector: 'app-aside, cui-aside',\r\n template: ``\r\n})\r\nexport class AppAsideComponent implements OnInit, OnDestroy {\r\n @Input() display: any;\r\n @Input() fixed: boolean;\r\n @Input() offCanvas: boolean;\r\n\r\n private readonly fixedClass = 'aside-menu-fixed';\r\n\r\n constructor(\r\n @Inject(DOCUMENT) private document: any,\r\n private renderer: Renderer2,\r\n private hostElement: ElementRef\r\n ) {\r\n renderer.addClass(hostElement.nativeElement, 'aside-menu');\r\n }\r\n\r\n ngOnInit(): void {\r\n this.isFixed(this.fixed);\r\n this.isOffCanvas(this.offCanvas);\r\n this.displayBreakpoint(this.display);\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.renderer.removeClass(this.document.body, this.fixedClass);\r\n }\r\n\r\n isFixed(fixed: boolean = this.fixed): void {\r\n if (fixed) {\r\n this.renderer.addClass(this.document.body, this.fixedClass);\r\n }\r\n }\r\n\r\n isOffCanvas(offCanvas: boolean = this.offCanvas): void {\r\n if (offCanvas) {\r\n this.renderer.addClass(this.document.body, 'aside-menu-off-canvas');\r\n }\r\n }\r\n\r\n displayBreakpoint(display: any = this.display): void {\r\n if (display !== false ) {\r\n const cssClass = this.display ? `aside-menu-${this.display}-show` : asideMenuCssClasses[0];\r\n this.renderer.addClass(this.document.body, cssClass);\r\n }\r\n }\r\n}\r\n","import { CommonModule} from '@angular/common';\r\nimport { NgModule } from '@angular/core';\r\nimport { LayoutModule } from './../shared/layout/layout.module';\r\n\r\nimport { AppAsideComponent } from './app-aside.component';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n LayoutModule\r\n ],\r\n exports: [\r\n AppAsideComponent,\r\n LayoutModule\r\n ],\r\n declarations: [\r\n AppAsideComponent\r\n ]\r\n})\r\nexport class AppAsideModule {}\r\n","import { Injectable } from '@angular/core';\r\nimport { Router, ActivatedRoute, NavigationEnd } from '@angular/router';\r\nimport { BehaviorSubject, Observable } from 'rxjs/index';\r\nimport { filter } from 'rxjs/operators';\r\n\r\n@Injectable()\r\nexport class AppBreadcrumbService {\r\n\r\n breadcrumbs: Observable>;\r\n\r\n private _breadcrumbs: BehaviorSubject>;\r\n\r\n constructor(private router: Router, private route: ActivatedRoute) {\r\n\r\n this._breadcrumbs = new BehaviorSubject