Scope issue in AngularJS using AngularUI Bootstrap Modal

后端 未结 3 996
独厮守ぢ
独厮守ぢ 2020-11-28 06:36

plunker: http://plnkr.co/edit/wURNg8ByPYbEuQSL4xwg

example.js:

angular.module(\'plunker\', [\'ui.bootstrap\']);
  var ModalDemoCtrl          


        
3条回答
  •  孤城傲影
    2020-11-28 06:58

    Looks like a scope issue. I got it to work like this:

    var ModalInstanceCtrl = function ($scope, $modalInstance) {
        $scope.input = {};
        $scope.ok = function () {
            alert($scope.input.abc);
        };
    
        $scope.cancel = function () {
            $modalInstance.dismiss('cancel');
        };
    };
    

    HTML:

    
    

提交回复
热议问题