0

I am using bootstrap3-dialog in my Aurelia project, so, theres a way to compile template in view-model? like

export class MyComponent {
    ...
      showMyDialog() {
        bootstrapDialog.show({
          title: 'My title',
          message: `
            <select class="form-control" style="width: 100%;" select2.bind="{placeholder: '-- select an option --'}">
              <option></option>
              <option value="1">First value</option>
              <option value="2">Second value</option>
            </select>
          `,
          buttons: [{
            label: 'Cancel',
            action: (dialog) => {
              dialog.close();
            }
          }, {
            label: 'OK',
            cssClass: 'btn-primary',
            action: (dialog) => {
              this.doMyThing();
              dialog.close();
            }
          }]
        });
      }
    ...
}

the message param has a custom attribute select2, but in this code has no effect

talski
  • 293
  • 2
  • 11
  • 2
    You may need to compile the string to a proper template. See [this github issue](https://github.com/aurelia/templating/issues/35) – neilculver Jun 24 '16 at 13:43
  • 1
    This answer may help you http://stackoverflow.com/questions/37845208/generate-a-raw-html-string-from-a-component-file-and-a-view-model/37869319#37869319 – Charleh Jun 25 '16 at 22:03

0 Answers0