Skip to content

Commit

Permalink
fix(modal): Fix modal.service:show() buttons to be an array.
Browse files Browse the repository at this point in the history
fix(modal): Added more documentation.
feat(modal): modal.service:show() can now supports HTML in `modalContent`.
  • Loading branch information
stanislavgeorgiev committed Oct 2, 2018
1 parent 7cdf84a commit ef43792
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/modal/alert-modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ import Modal from "./modal.decorator";
<p class="bx--modal-header__heading bx--type-beta">{{modalTitle}}</p>
</ibm-modal-header>
<div class="bx--modal-content">
<p>{{modalContent}}</p>
<p [innerHTML]="modalContent"></p>
</div>
<ibm-modal-footer *ngIf="buttons.length > 0">
<ng-container *ngFor="let button of buttons; let i = index">
Expand Down
8 changes: 6 additions & 2 deletions src/modal/modal.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ export class ModalService {

/**
* Creates and renders a new alert modal component.
* @param data You can pass in `title`, `text` and `buttons` to be used in the modal.
* @param data You can pass in:
* `modalType` - "default" | "danger" = "default",
* `modalLabel` - a label shown over the title,
* `modalTitle` - modal's title,
* `modalContent` - modal's content, could include HTML tags.
* `buttons` is an array of objects
* ```
* {
Expand All @@ -82,7 +86,7 @@ export class ModalService {
* @returns {ComponentRef<any>}
* @memberof ModalService
*/
show(data: {modalType?: string, modalLabel?: string, modalTitle: string, modalContent: string, buttons?: null}) {
show(data: {modalType?: string, modalLabel?: string, modalTitle?: string, modalContent?: string, buttons?: []}) {
return this.create({
component: AlertModalComponent,
inputs: {
Expand Down

0 comments on commit ef43792

Please sign in to comment.