我已经使用angular bootstrap实现了一个bootstrap模态框,它工作得很好。
这里是我使用的plunker链接的代码。
在我的模态框中,我只有一个需要用户填写的输入字段(文本框),以及保存和取消按钮。我希望当模态框显示时,文本框应该获得焦点。
我尝试过
以下是我的模态框上的html粘贴。
我该怎么让这个工作起来?
这里是我使用的plunker链接的代码。
在我的模态框中,我只有一个需要用户填写的输入字段(文本框),以及保存和取消按钮。我希望当模态框显示时,文本框应该获得焦点。
我尝试过
autofocus
属性,但在这种情况下不起作用。以下是我的模态框上的html粘贴。
<div class="modal-header panel panel-heading">
<button type="button" class="close" ng-click="ok()">×</button>
<h4 class="modal-title">Add Project</h4>
</div>
<div class="modal-body">
<input autofocus="autofocus" type="text" class="form-control" id="ProjectName" placeholder="Enter project name here" data-ng-model="ProjectName" tab-index="1"/>
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="ok()" tab-index="2">Create</button>
<button class="btn btn-default" ng-click="cancel()" tab-index="3">Cancel</button>
</div>
我该怎么让这个工作起来?