A widget for showing a configuration page / widget inside a popup modal dialog.
$juciDialog
- a factory for use in controller.
show(widget:string, params:object)
Widget:
Params:
model
- object that represents the model that will be passed to the widget inside the dialog box.buttons
- object with fields on_button(button, modalInstance)
- callback that gets called on button being clicked (default: close on cancel, call on_apply on accept)on_apply(button, modalInstance)
- gets called as default action for apply button (only called if you don't override on_button)Returns: promise
$juciDialog.show("uci-wireless-interface", {
title: $tr(gettext("Edit wireless interface")),
on_apply: function(btn, dlg){
// here we have opportunity to validate the data and not close dialog if data is invalid (by returning false)
$uci.$save();
return true;
},
model: iface.uci_dev
}).done(function(){
// we get here when dialog is closed (and has been accepted)
}).fail(function(){
// called when dialog is canceled or closed
});