我有一个模态(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:
这部分从模态 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 索引,并在那里放置不同类型的输入(复选框有效,文本区域无效)。正如我之前所说,该模式是从另一个模式打开的,但第二个模式不是使用 Angular UI Bootstrap 创建的(我正在慢慢转向 Angular UI)