Skip to content

Commit ff50eee

Browse files
authored
Merge pull request #463 from stanislavgeorgiev/master
fix(modal): Bring new modals on top of the old ones.
2 parents 99c9da5 + 7e056a6 commit ff50eee

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

src/modal/modal.stories.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ModalModule } from "../";
55
import { Component, Input, Inject } from "@angular/core";
66
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
77
import { Modal, ModalService } from "../";
8-
import { ModalButton, AlertModalType } from "./alert-modal.interface";
8+
import { ModalButton, AlertModalType, ModalButtonType } from "./alert-modal.interface";
99
import { PlaceholderModule } from "./../placeholder/placeholder.module";
1010
import { BaseModal } from "./base-modal.class";
1111
import { ExperimentalComponenent } from "../../.storybook/experimental.component";
@@ -21,15 +21,34 @@ import { ExperimentalModule } from "../experimental.module";
2121
<p class="bx--modal-content__text">{{modalText}}</p>
2222
</section>
2323
<ibm-modal-footer>
24+
<button class="bx--btn bx--btn--secondary" (click)="showSecondaryModal()">Show Secondary Modal</button>
2425
<button class="bx--btn bx--btn--primary" modal-primary-focus (click)="closeModal()">Close</button>
2526
</ibm-modal-footer>
2627
</ibm-modal>
2728
`
2829
})
2930
class SampleModal extends BaseModal {
30-
constructor(@Inject("modalText") public modalText) {
31+
constructor(
32+
@Inject("modalText") public modalText,
33+
protected modalService: ModalService) {
3134
super();
3235
}
36+
37+
showSecondaryModal() {
38+
this.modalService.show({
39+
modalLabel: "Secondary header label",
40+
modalTitle: "Sample secondary modal works.",
41+
modalContent: this.modalText,
42+
buttons: [{
43+
text: "Cancel",
44+
type: ModalButtonType.secondary
45+
}, {
46+
text: "OK",
47+
type: ModalButtonType.primary,
48+
click: () => alert("OK button clicked")
49+
}]
50+
});
51+
}
3352
}
3453

3554
@Component({

src/placeholder/placeholder.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class PlaceholderService {
3030
if (!this.viewContainerRef) {
3131
console.error("No view container defined! Likely due to a missing `ibm-placeholder`");
3232
}
33-
return this.viewContainerRef.createComponent(componentFactory, 0, injector);
33+
return this.viewContainerRef.createComponent(componentFactory, null, injector);
3434
}
3535

3636
destroyComponent(component: ComponentRef<any>) {

0 commit comments

Comments
 (0)