ui bootstrap modal's controller 'is not defined'

前端 未结 2 898
面向向阳花
面向向阳花 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: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;
                }
            }
        });
    

提交回复
热议问题