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

fix(alert): triggers change detection after timeout #6

Merged
merged 2 commits into from
Feb 4, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion libs/ngxsmart/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ngxsmart/ngxsmart",
"version": "13.0.4",
"version": "13.0.5",
"repository": {
"type": "git",
"url": "https://github.com/ngxsmart/ngxsmart.git"
Expand Down
17 changes: 4 additions & 13 deletions libs/ngxsmart/src/lib/alert/alert.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input, OnChanges, OnInit } from "@angular/core";
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit } from "@angular/core";

/**
* Boostrap Alert component that can be used to alert messages to the user
Expand All @@ -11,7 +11,7 @@ import { Component, Input, OnChanges, OnInit } from "@angular/core";
templateUrl: "./alert.component.html",
styleUrls: ["./alert.component.scss"]
})
export class AlertComponent implements OnInit, OnChanges {
export class AlertComponent implements OnInit {
/**
* Type of the BootStrap Alert. Following values are supported. See BootStrap docs for more information
* <pre>
Expand Down Expand Up @@ -47,7 +47,7 @@ export class AlertComponent implements OnInit, OnChanges {
*/
@Input() dismissTimeout = 5000;

constructor() {
constructor(private cdr: ChangeDetectorRef) {
}

/**
Expand All @@ -62,20 +62,11 @@ export class AlertComponent implements OnInit, OnChanges {
if (this.dismissOnTimeout) {
setTimeout(() => {
this.closeAlert();
this.cdr.markForCheck();
}, this.dismissTimeout);
}
}

/**
* Watch for changes in inputs
*
* @author Pavan Kumar Jadda
* @since 12.0.0
*/
ngOnChanges(): void {
// Watch for changes in inputs
}

/**
* Closes BootStrap Alert if not open
*
Expand Down