11import {
22 Component ,
33 Injector ,
4- ElementRef
4+ ElementRef ,
5+ Inject
56} from "@angular/core" ;
67import {
78 trigger ,
@@ -71,7 +72,7 @@ import Modal from "./modal.decorator";
7172 ibmButton="{{button.type}}"
7273 (click)="buttonClicked(i)"
7374 [id]="button.id"
74- [attr.modal-primary-focus]="button.type.indexOf('primary') !== -1 ? '' : null">
75+ [attr.modal-primary-focus]="( button.type.indexOf('primary') !== -1 ? '' : null) ">
7576 {{button.text}}
7677 </button>
7778 </ng-container>
@@ -80,27 +81,18 @@ import Modal from "./modal.decorator";
8081 `
8182} )
8283export class AlertModalComponent {
83- modalType = "default" ;
84- modalLabel : string ;
85- modalTitle : string ;
86- modalContent : string ;
87- buttons = [ ] ;
88-
8984 /**
9085 * Creates an instance of `AlertModalComponent`.
9186 * @param {ModalService } modalService
9287 * @memberof AlertModalComponent
9388 */
9489 constructor (
95- private injector : Injector ,
96- private elementRef : ElementRef
90+ @Inject ( "modalType" ) public modalType = "default" ,
91+ @Inject ( "modalLabel" ) public modalLabel : string ,
92+ @Inject ( "modalTitle" ) public modalTitle : string ,
93+ @Inject ( "modalContent" ) public modalContent : string ,
94+ @Inject ( "buttons" ) public buttons = [ ]
9795 ) {
98- this . modalType = this . injector . get ( "modalType" ) ;
99- this . modalLabel = this . injector . get ( "modalLabel" ) ;
100- this . modalTitle = this . injector . get ( "modalTitle" ) ;
101- this . modalContent = this . injector . get ( "modalContent" ) ;
102-
103- this . buttons = this . injector . get ( "buttons" ) || [ ] ;
10496 for ( let i = 0 ; i < this . buttons . length ; i ++ ) {
10597 const button = this . buttons [ i ] ;
10698 if ( ! button . id ) {
0 commit comments