Reputation: 171
How to call $modal.open
from controller in angular js. Previously in ui-bootstrap 0.1.0 dialog was there. Now in current version what is the privision to call your dialog.
in 0.1.0 it was just $dialog.dialog(); Then call to Dialog (); in Lib -
return {
// Creates a new `Dialog` with the specified options.
dialog: function(opts){
return new Dialog(opts);
},
// creates a new `Dialog` tied to the default message box template and controller.
//
// Arguments `title` and `message` are rendered in the modal header and body sections respectively.
// The `buttons` array holds an object with the following members for each button to include in the
// modal footer section:
// * `result`: the result to pass to the `close` method of the dialog when the button is clicked
// * `label`: the label of the button
// * `cssClass`: additional css class(es) to apply to the button for styling
messageBox: function(title, message, buttons){
return new Dialog({templateUrl: 'template/dialog/message.html',
controller: 'MessageBoxController', resolve: {model: {
title: title,
message: message,
buttons: buttons
}}});
}
Can any one know how to call $modal.open in 0.10.0 ?
Upvotes: 4
Views: 8031
Reputation: 23214
function open() {
var modalInstance = $modal.open({
templateUrl: 'myModalContent.html',
controller: ModalInstanceCtrl,
resolve: {
items: function () {
return $scope.items;
}
}
});
});
var ModalInstanceCtrl = function ($scope, $modalInstance, items) {
$scope.items = items;
});
open();
replace
function open() {
to
$scope.open = function() {
and call
$scope.open()
Upvotes: 6