Estoy tratando de crear un diálogo OJET. Aunque estoy usando directamente el código del libro de cocina, recibo un error como "Error no detectado (en promesa): no puede aplicar enlaces varias veces al mismo elemento".
A continuación se muestra el código que estoy usando.
<div id="dialogWrapper"> <oj-dialog id="modalDialog1" dialog-title="Modal Dialog"> <div slot="body"> This is the dialog content. User can change dialog resize behavior, cancel behavior and drag behavior by setting attributes. Default attribute value depends on the theme. </div> <div slot="footer"> <oj-button id="okButton" on-oj-action="[[close]]">OK </oj-button> </div> </oj-dialog> <oj-button id="buttonOpener" on-oj-action="[[open]]"> Open Modal Dialog </oj-button> <div class="oj-sm-padding-4x-top" id='form-container'> <oj-form-layout direction="row" max-columns="1"> <oj-input-text value="{{textVal1}}" label-hint="Address 1"></oj-input-text> <oj-input-text value="{{textVal2}}" label-hint="Address 2"></oj-input-text> </oj-form-layout> </div> </div>
El código ViewModel correspondiente es
require(["require", "exports", "knockout", "ojs/ojbootstrap", "ojs/ojknockout", "ojs/ojbutton", "ojs/ojdialog", "ojs/ojformlayout", "ojs/ojinputtext"], function (require, exports, ko, Bootstrap) { "use strict"; class viewModel { constructor() { this.textVal1 = ko.observable(""); this.textVal2 = ko.observable(""); } close(event) { document.getElementById("modalDialog1").close(); } open(event) { document.getElementById("modalDialog1").open(); } } Bootstrap.whenDocumentReady().then(() => { ko.applyBindings(new viewModel(), document.getElementById("dialogWrapper")); }); });
¿Puede alguien ayudarme a entender cuál es el error que estoy cometiendo?