Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix: #13933 - SideBar onHide Not trigger #13959

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/app/components/sidebar/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ import {
Inject,
Input,
NgModule,
OnChanges,
OnDestroy,
Output,
QueryList,
Renderer2,
SimpleChanges,
TemplateRef,
ViewEncapsulation
} from '@angular/core';
Expand Down Expand Up @@ -95,7 +97,7 @@ const hideAnimation = animation([animate('{{transition}}', style({ transform: '{
class: 'p-element'
}
})
export class Sidebar implements AfterViewInit, AfterContentInit, OnDestroy {
export class Sidebar implements AfterViewInit, AfterContentInit, OnDestroy, OnChanges {
/**
* Target element to attach the dialog, valid values are "body" or a local ng-template variable of another element (note: use binding with brackets for template variables, e.g. [appendTo]="mydiv" for a div element having #mydiv as variable name).
* @group Props
Expand Down Expand Up @@ -256,6 +258,17 @@ export class Sidebar implements AfterViewInit, AfterContentInit, OnDestroy {
this.initialized = true;
}

ngOnChanges(changes: SimpleChanges): void {
if(changes.visible){
if(!changes.visible.firstChange){
if(changes.visible.currentValue === false){
this.hide();
}
}
}
}


ngAfterContentInit() {
this.templates?.forEach((item) => {
switch (item.getType()) {
Expand Down
Loading