加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angularjs – 文本输入框不接受来自Angular UI Bootstrap的模态

发布时间:2020-12-17 08:51:31 所属栏目:安全 来源:网络整理
导读:我有一个模态(nbr 1),我从另一个模态打开(nbr 2).模态nbr 1工作正常,并显示它应该的东西.但我试图在模态中输入过滤项目,但输入不起作用.我不能写任何东西,它只是不接受我的意见. 我认为这与我的第二个模态这一事实有关,因为当我从“根”打开它(不是从另一个
我有一个模态(nbr 1),我从另一个模态打开(nbr 2).模态nbr 1工作正常,并显示它应该的东西.但我试图在模态中输入过滤项目,但输入不起作用.我不能写任何东西,它只是不接受我的意见.

我认为这与我的第二个模态这一事实有关,因为当我从“根”打开它(不是从另一个模态打开它)时,文本输入工作正常.

这是我的HTML:

<div class="modal-header">
  <h3 class="modal-title">Pick a student</h3>
<div class="modal-body">

  <!-- I can't type in this text field,no matter where it's placed och if it has any attributes at all -->
  <input type="text" class="form-control" id="searchUsers" placeholder="Search by name,personal ID number or group" ng-model="search.$" ng-click="console.log('omg')">
  <table class="table table-hover table-striped equi-table">
    <tbody>
      <tr ng-repeat="user in state.users | filter:search:strict">
        <td>{{ user.firstName }}</td>
        <td>{{ user.lastName }}</td>
        <td>{{ user.personalIDNumber }}</td>
      </tr>
    </tbody>
  </table>
</div>

这是JavaScript:

这部分从modal nbr 2打开模态:

$scope.addUserToCourse = function () {
  utilities.pickAUserModal();
};

这是实际的模态

angular.module('equiclass.services')
.factory('utilities',function ($modal) {
  var pickAUserModal = function () {
    var modalInstance = $modal.open({
      templateUrl: '/views/modals/pick-a-user-modal.html',controller: function ($scope,$modalInstance,stateService,userService) {
        var log = loggingService.getLogger ('pickAUserModal');

        $scope.state = userService.state;
        userService.initializeUsers().then(function () {
          $scope.hasInitialized = true;
        });

        $scope.ok = function () {
          $modalInstance.close(true);
        };

        $scope.cancel = function () {
          $modalInstance.close(false);
        };
      }
    });
  };

  return {
    pickAUserModal: pickAUserModal
  };
});

为什么我不能在文本输入中输入任何内容?我已经尝试编辑z索引,并在那里放置不同类型的输入(复选框工作,textareas不工作).正如我之前所说,模态是从另一个模态打开的,但模态数字2不是使用Angular UI Bootstrap创建的(我正在慢慢地逐步转向角度UI)

我有角度模式模式的相同问题,我无法写入任何输入字段.几个小时后,我发现了什么是错的以及如何解决它.问题来自bootstrap-additions.min.css和类.modal.center .modal-dialog,其中position属性是固定的.我不知道为什么但是将所有输入字段分解为我的模态.当你对该属性使用绝对位置时,模态块的工作正常.
.modal.center .modal-dialog{
    position:absolute !important;
    top:40%;left:50%;
    min-width:320px;
    max-width:630px;
    width:50%;
    -webkit-transform:translateX(-50%) translateY(-50%);
    transform:translateX(-50%) translateY(-50%)
}

我希望这可以帮助您解决问题.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读