[AngularJS] TypeError: Object # has no method 'then'

Fri, 07 Feb 2014 15:35:33 -0800

Basically im trying to use a generic modal for delete or save any course, 
using *Angular UI Bootstrap* but I get this error

Im just started with Angular BTW

TypeError: Object #<Object> has no method 'then' at Scope.$scope.delete (
http://localhost:13862/Scripts/app/controllers/coursesController.js:72:18<http://localhost:13862/Scripts/app/controllers/coursesController.js>
)


$scope['delete'] = function (entity) {
            var titulo = "Confirm";
            var mess = "Are you sure you want to delete the course: " + 
entity.Name + " ?";
            var buttones = [{
                label: 'Eliminar', cssClass: 'btn-danger', result: 'ok'
            }, {
                label: 'Cancel', result: 'cancel'
            }];
            debugger;
            var modalInstance = $modal.open({
                templateUrl: '/Content/templates/dialog/message.html',
                controller: ModalInstanceCtrl,
                resolve: {
                    buttons: function () {
                        return $scope.buttons;
                    },
                    title: function () {
                        return $scope.title;
                    },
                    message: function () {
                        return $scope.message;
                    }
                }
            },
            $scope.buttons = buttones,
            $scope.title = titulo,
            $scope.message = mess)
                *.then(function (result) {*
*                    if (result == 'ok') {*
*                        coursesService['delete'](entity.Id, $scope.cancel, 
handleError);*
*                    }*
*                });*

        };



var ModalInstanceCtrl = function ($scope, $modalInstance, buttons, title, 
 message) {
                $scope.title = title;
                $scope.message = message;
                $scope.buttons = buttons;
                //$scope.selected = {
                //    item: $scope.buttons[0]
                //};

                //$scope.ok = function () {
                //    $modalInstance.close($scope.selected.item);
                //};

                $scope.cancel = function () {
                    $modalInstance.dismiss('cancel');
                };
            };

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to