Skip to content

Commit 5d01700

Browse files
unknownquentinderoubaix
unknown
authored andcommitted
demo(offcanvas): fix dismiss reason not updated on ESC and backdrop
1 parent 3cbc681 commit 5d01700

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

demo/src/app/components/offcanvas/demos/basic/offcanvas-basic.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ <h4 class="offcanvas-title" id="offcanvas-basic-title">Profile update</h4>
3030

3131
<hr />
3232

33-
<pre>{{ closeResult }}</pre>
33+
<pre>{{ closeResult() }}</pre>

demo/src/app/components/offcanvas/demos/basic/offcanvas-basic.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, inject, TemplateRef } from '@angular/core';
1+
import { Component, inject, signal, TemplateRef, WritableSignal } from '@angular/core';
22

33
import { NgbDatepickerModule, NgbOffcanvas, OffcanvasDismissReasons } from '@ng-bootstrap/ng-bootstrap';
44

@@ -9,15 +9,15 @@ import { NgbDatepickerModule, NgbOffcanvas, OffcanvasDismissReasons } from '@ng-
99
})
1010
export class NgbdOffcanvasBasic {
1111
private offcanvasService = inject(NgbOffcanvas);
12-
closeResult = '';
12+
closeResult: WritableSignal<string> = signal('');
1313

1414
open(content: TemplateRef<any>) {
1515
this.offcanvasService.open(content, { ariaLabelledBy: 'offcanvas-basic-title' }).result.then(
1616
(result) => {
17-
this.closeResult = `Closed with: ${result}`;
17+
this.closeResult.set(`Closed with: ${result}`);
1818
},
1919
(reason) => {
20-
this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
20+
this.closeResult.set(`Dismissed ${this.getDismissReason(reason)}`);
2121
},
2222
);
2323
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy