简体   繁体   English

Angular2自定义模态主体

[英]Angular2 customize modal body

I have an Angular2 App that can show a modal. 我有一个可以显示模态的Angular2应用。 For that i call an injectable method inside a Js class: 为此,我在Js类内调用了可注入方法:

@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 ). 您可以添加styles或styleUrl属性( 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. 另外,您也可以看看如何使用Chrome的开发者工具(或您喜欢的浏览器的开发者工具)构造模态,并找出模态使用了哪些类,并添加自定义css文件来设置所需的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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