How to insert a $ scope object into a dialog template?

I have this plunker with an example dialog that uses the permission attribute of the option object based on this example .
Basically, what I want to do is pass the variable title that will be used in the dialog template:

var title = "azerty"; 

Using the permission attribute of the dialog settings object:

 resolve: {title: angular.copy(title)} 

Then add it to the dialog controller and assign it to the $ scope variable:

 controllers.DialogController = function($scope, dialog, title) { $scope.title = title; 

But I get this error:

Error: Unknown provider: azertyProvider <- azerty

+6
source share
1 answer

Starting with release 0.2.0 ( https://github.com/angular-ui/bootstrap/blob/master/CHANGELOG.md#020-2013-03-03 ) we updated the permission syntax to match the one used by $ routeProvider . In practice, this means that the value in the resolution of the object should be a function:

 resolve: { title: function() { return angular.copy(title); } } 

Here is the work plan: http://plnkr.co/edit/qmNUsWK7RGeAjXcANuWv?p=preview

By the way, you do not need (and should not even) enable Bootstrap's JavaScript. This project has no dependencies on any external JavaScript (besides AngularJS itself), so you do not need jQuery.

+10
source

All Articles