I want to add a new (dialog) type to angular, so I could use it the same way I use module.directive , module.filter , module.controller to register directives, filters, and controllers.
I want to register my dialog type instances as follows:
module.dialog('prompt',function(dependencies){ return { templateUrl:'prompt.html', controller:function($scope){}, something:'value' } });
I also want to be able to use registered dialogs in controllers (dependency injection)
module.controller('ListCtrl',function($scope,prompt){ $scope.deleteItem = function(item){ prompt('Do you want to delete this item?').then(function(result){ if(result) item.$delete(); }); } });
It comes down to the following questions:
How to extend angular module so module.dialog registers my dialog types?
How to make registered dialogs available to controllers , etc.
Btw,
- I know about
angular-ui and angular-strap . - I would prefer not to use
dialog as a service, but as a separate type (this solution is already implemented in angular-ui ).
angularjs angularjs-service
g00fy
source share