Material: md-dialog: support `.html()` for alert and confirm dialog?

Created on 13 Feb 2015  路  12Comments  路  Source: angular/material

I don't want to clone an alert / confirm dialog template & controller only to add newlines.
I prefer adding html() method or adding newline filter to alert & confirm dialog.

What do you think?

enhancement

Most helpful comment

You can use htmlContent()

All 12 comments

Can't you use a custom template to create your own HTML? Alert and Confirm dialogs are meant to be presets.

Yeah, but I think alert and confirm should be 'behavioural presets' mainly, leave the content customizable (text or html).

@marcysutton what about allowing \n and \t to be parsed in the .title() and .content() strings?

Since the $mdDialog uses <md-content>... </md-content>, I think the $mdDialog.alert().content( ) API should be used to insert any innerHTML content. Currently that method is used to inject text into a <p> area... which is not an intuitive API.

  • .content( ref ) should accept any unescaped string value (HTML) and inject as a child of the <md-content> container
  • .message( ref ) should accept any simple text and inject as the body of the of the <md-content><p>{ref}</p></md-content>

+1. Was thinking to implement my own version of confirm dialog as I need to bold some text in a message. As 0.10 milestone is in rc stage now I'll wait for this issue to be fixed.

Any news here?

.content() will support simple strings or strings with HTML markup.

:+1: Nice work! I'll be testing soon :)

In case anyone else wonders why they had this working in 0.11 and then it stopped working in 1.0: see 6a564508567cf1e352495bdf803f6db94334c601.

Is there any specific reason why this has been removed?

You can use htmlContent()

@SummerWish You are right. Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chriseyhorn picture chriseyhorn  路  3Comments

rdantonio picture rdantonio  路  3Comments

kasajian picture kasajian  路  3Comments

sbondor picture sbondor  路  3Comments

WebTechnolog picture WebTechnolog  路  3Comments