ui bootstrap modal's controller 'is not defined'

前端 未结 2 897
面向向阳花
面向向阳花 2020-12-25 12:10

i am trying to use the modal directive from ui-bootstrap 0.6

here is the working default plunker from the ui-bootstrap page:

http://plnkr.co/edit/JGBiBSeRqO

相关标签:
2条回答
  • 2020-12-25 12:50

    You can use quotes as the other answer suggests, or you can also do as the example in the docs and define the variable:

    var ModalInstanceCtrl = function ($scope, $modalInstance, items) { ... }

    0 讨论(0)
  • 2020-12-25 12:52

    Provide controller name as String, exactly as you would do in route definitions, directives etc.:

    var modalInstance = $modal.open({
            templateUrl: 'myModalContent.html',
            controller: 'ModalInstanceCtrl',
            resolve: {
                items: function () {
                return $scope.items;
                }
            }
        });
    
    0 讨论(0)
提交回复
热议问题