Question

I'm using angular-ui / bootstrap $dialog service

It's possible to load a partial inside messageBox? I would take the title and footer, changing only the message param. Thus, it would not be necessary to include the header and footer in partial template.

In this example http://plnkr.co/edit/ttobdpirZlnEQBE3LOeZ, illustrated the behavior I expect by clicking on the 'msg products'.

Was it helpful?

Solution

No. The messageBox method is meant to quickly create message boxes with the consistent look & feel. The idea behind this method is that you can quickly create alert-like messages that have consistent look & feel across the whole application.

As you've noticed the open method is a more flexible version and allows you to create any modal dialog with a partial specified by you.

If you would like to create many dialogs that use the same template you could wrap the $dialog service into your own service, for example:

app.factory('productsDialog', function($dialog){
  return function(products) {    
    return $dialog.dialog({
      templateUrl: 'products.html',
      controller: 'DialogCtrl',
      resolve: {products: function() { return products; }}      
    });
  };
});

and use it like so:

$scope.dlgProduct = function(){
    productsDialog($scope.products).open();
  };

Here is a working plunk: http://plnkr.co/edit/L2fd7b4y3woLDJmNiN3Y?p=preview

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top