mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-01-09 20:15:07 +00:00
(FuseNavigation) Merge the subscriptions
(FuseNavigationDocs) Updated the docs
This commit is contained in:
parent
ab7bd882a0
commit
8961d75241
|
@ -1,14 +1,14 @@
|
|||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
import { merge, Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||
|
||||
@Component({
|
||||
selector : 'fuse-navigation',
|
||||
templateUrl : './navigation.component.html',
|
||||
styleUrls : ['./navigation.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
selector : 'fuse-navigation',
|
||||
templateUrl : './navigation.component.html',
|
||||
styleUrls : ['./navigation.component.scss'],
|
||||
encapsulation : ViewEncapsulation.None,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class FuseNavigationComponent implements OnInit
|
||||
|
@ -60,31 +60,16 @@ export class FuseNavigationComponent implements OnInit
|
|||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
|
||||
// Subscribe to navigation item additions
|
||||
this._fuseNavigationService.onNavigationItemAdded
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe(() => {
|
||||
// Subscribe to navigation item
|
||||
merge(
|
||||
this._fuseNavigationService.onNavigationItemAdded,
|
||||
this._fuseNavigationService.onNavigationItemUpdated,
|
||||
this._fuseNavigationService.onNavigationItemRemoved
|
||||
).pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe(() => {
|
||||
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
|
||||
// Subscribe to navigation item updates
|
||||
this._fuseNavigationService.onNavigationItemUpdated
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe(() => {
|
||||
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
|
||||
// Subscribe to navigation item removal
|
||||
this._fuseNavigationService.onNavigationItemRemoved
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe(() => {
|
||||
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { ChangeDetectorRef, Component, HostBinding, Input, OnDestroy, OnInit } from '@angular/core';
|
||||
import { NavigationEnd, Router } from '@angular/router';
|
||||
import { Subject } from 'rxjs';
|
||||
import { merge, Subject } from 'rxjs';
|
||||
import { filter, takeUntil } from 'rxjs/operators';
|
||||
|
||||
import { FuseNavigationItem } from '@fuse/types';
|
||||
|
@ -114,32 +114,17 @@ export class FuseNavVerticalCollapsableComponent implements OnInit, OnDestroy
|
|||
this.collapse();
|
||||
}
|
||||
|
||||
// Subscribe to navigation item additions
|
||||
this._fuseNavigationService.onNavigationItemAdded
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe(() => {
|
||||
// Subscribe to navigation item
|
||||
merge(
|
||||
this._fuseNavigationService.onNavigationItemAdded,
|
||||
this._fuseNavigationService.onNavigationItemUpdated,
|
||||
this._fuseNavigationService.onNavigationItemRemoved
|
||||
).pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe(() => {
|
||||
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
|
||||
// Subscribe to navigation item updates
|
||||
this._fuseNavigationService.onNavigationItemUpdated
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe(() => {
|
||||
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
|
||||
// Subscribe to navigation item removal
|
||||
this._fuseNavigationService.onNavigationItemRemoved
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe(() => {
|
||||
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { ChangeDetectorRef, Component, HostBinding, Input, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
import { merge, Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
import { FuseNavigationItem } from '@fuse/types';
|
||||
|
@ -48,32 +48,17 @@ export class FuseNavVerticalGroupComponent implements OnInit, OnDestroy
|
|||
*/
|
||||
ngOnInit(): void
|
||||
{
|
||||
// Subscribe to navigation item additions
|
||||
this._fuseNavigationService.onNavigationItemAdded
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe(() => {
|
||||
// Subscribe to navigation item
|
||||
merge(
|
||||
this._fuseNavigationService.onNavigationItemAdded,
|
||||
this._fuseNavigationService.onNavigationItemUpdated,
|
||||
this._fuseNavigationService.onNavigationItemRemoved
|
||||
).pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe(() => {
|
||||
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
|
||||
// Subscribe to navigation item updates
|
||||
this._fuseNavigationService.onNavigationItemUpdated
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe(() => {
|
||||
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
|
||||
// Subscribe to navigation item removal
|
||||
this._fuseNavigationService.onNavigationItemRemoved
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe(() => {
|
||||
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { ChangeDetectorRef, Component, HostBinding, Input, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
import { merge, Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
import { FuseNavigationItem } from '@fuse/types';
|
||||
|
@ -48,32 +48,17 @@ export class FuseNavVerticalItemComponent implements OnInit, OnDestroy
|
|||
*/
|
||||
ngOnInit(): void
|
||||
{
|
||||
// Subscribe to navigation item additions
|
||||
this._fuseNavigationService.onNavigationItemAdded
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe(() => {
|
||||
// Subscribe to navigation item
|
||||
merge(
|
||||
this._fuseNavigationService.onNavigationItemAdded,
|
||||
this._fuseNavigationService.onNavigationItemUpdated,
|
||||
this._fuseNavigationService.onNavigationItemRemoved
|
||||
).pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe(() => {
|
||||
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
|
||||
// Subscribe to navigation item updates
|
||||
this._fuseNavigationService.onNavigationItemUpdated
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe(() => {
|
||||
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
|
||||
// Subscribe to navigation item removal
|
||||
this._fuseNavigationService.onNavigationItemRemoved
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe(() => {
|
||||
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -216,7 +216,7 @@
|
|||
this._fuseNavigationService.updateNavigationItem('mail', {
|
||||
badge: {
|
||||
title: 35
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</textarea>
|
||||
|
|
|
@ -47,8 +47,10 @@ export class DocsComponentsNavigationComponent
|
|||
updateMailBadge(): void
|
||||
{
|
||||
// Update the badge title
|
||||
this._fuseNavigationService.updateNavigationItem('02001', {
|
||||
title: 'Transactionssss'
|
||||
this._fuseNavigationService.updateNavigationItem('mail', {
|
||||
badge: {
|
||||
title: 35
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user