In my application, after I found out that the user is not registered, I want to open a modal dialog:
.when('/showtask/:id', {templateUrl: 'Home/Template/showtask', resolve: ShowTaskCtrl.resolve, access: { allowAnonymous: false }, resolve: { userAuthenticated: ["$http", "$q", function ($http, $q) { var deferred = $q.defer(); $http.get('/api/Authentication/UserAuthenticated').then(function (data) { if (data.data != "null") { deferred.resolve(data.data); } else { var modalInstance = { templateUrl: 'Home/Template/loginfailed', controller: 'ModalInstanceCtrl', modalpart: ['modalpart', function (modalpart) { return modalInstance; }] }; $modal.open(modalInstance); deferred.reject(); } }); return deferred.promise; }] }
Since this happens when changing the route, I have to enter modalpart inside the instance and get it in the controller.
var ModalInstanceCtrl = WorkerApp.controller('ModalInstanceCtrl', ["$scope", "modalpart", function ($scope, modalpart) {
But I keep getting this error:
Unknown provider: modalpartProvider <- modalpart
How can I solve this problem?
PS The source code I'm looking at is here: http://angular-ui.imtqy.com/bootstrap/ (under modal)
angularjs angular-ui
Timsen
source share