无法在角文本框中输入文本

时间:2016-08-09 14:05:12

标签: javascript angularjs html5

我在2个不同的模板中使用以下输入文本框标签。

<div class="text-input">
  <input type="text" class="form-control" id="" placeholder="">
</div>

在第一个模板中,我可以输入文字。但是当我将视图更改为第二个模板时,我无法在文本框中输入文本。再次当我回到第一个模板时,我无法输入文字。

我在控制台中注意到文本框最初都处于以下状态(在单击文本框之前输入文本):

<input type="text" class="form-control ng-pristine ng-valid ng-empty ng-touched" id="" placeholder="" style="">

当输入文字时,课程将更新为

<input type="text" class="form-control ng-valid ng-touched ng-not-empty ng-dirty ng-valid-parse" id="" placeholder="" >

禁用时,课程中没有任何变化。

可能出现的问题是什么?如何解决这个问题?

编辑:

<form class="view-tools ">
   <ng-include src="'views/view1.tpl.html'"></ng-include>
</form>

<form class="view-tools ">
   <ng-include src="'views/view2.tpl.html'"></ng-include>
</form>

我在控制器中有一个函数,它基本上将范围变量设置为true或false以显示/隐藏视图。

1 个答案:

答案 0 :(得分:0)

尝试在输入中添加必需 ng-model

<input type="text" ng-model="thisInput" class="form-control" id="" placeholder="" required>

看看是否修复了它

相关问题