简体   繁体   中英

Angular2 customize modal body

I have an Angular2 App that can show a modal. For that i call an injectable method inside a Js class:

@Injectable()
public showErrorDialog(errorMessage:string, isError:boolean) {

    this.modal.alert()
    .size('sm')
    .showClose(true)
    .title("Modal Title")
    .body(errorMessage)
    .open();
}

Now i would customize body of modal, by changing background, and text style. How can i do?

You have a few options - are you using this via a component? You could add the styles or styleUrl property ( https://angular.io/docs/ts/latest/guide/component-styles.html ). Alternatively you could also take a look at how the modal is constructed using Chrome's Developer tool (or your preferred browser's developer tool) and find out what classes are being used by the modal and add a custom css file to set your desired values.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM