我對ng-include元素的ng-focus存在問題。我用這部分代碼ng-focus不適用於ng-include
<div ng-include="'template.tpl.html'" ng-controller="Ctrl"
ng-class="{'highlight':highlight==true,'nofocus':highlight==false}"></div>
和NG重點工作正常,當我有template.tpl.html常規的DOM元素中,如:
<div class="form-group">
<label class="control-label">My label</label>
<div class="input-wrap">
<input type="text" name="Name" class="form-control"
ng-model="client.firstName" ng-disabled="displayMode != 'edit'"
ng-focus="highlight=true" ng-blur="highlight=false">
</div>
</div>
,但是,如果我包括template.tpl另一個文件.html它不起作用了。例如,如果我申請在template.tpl.html像下面是行不通的結構:
<div ng-include="'contacts/contacts-list.tpl.html'"></div>
爲什麼NG-焦點不會在工作NG-包括包含在NG-包括哪些內容?有關如何解決此問題的任何提示?
適用於我http://plnkr.co/edit/bWYANdm8Rf9ohaGnBatT?p=preview – PSL 2014-10-03 15:14:03
適用於我。也許你的模板正在從緩存中加載,你會得到一個過時的模板文件。在Chrome開發者模式下嘗試進行硬刷新以清除模板緩存。 – zszep 2014-10-03 15:29:35
我想我沒有解釋得很清楚。這是plnkr,看看我指的是:http://plnkr.co/edit/iIxgAPmK7GZgZqD0dRYA?p=preview – bigcat 2014-10-03 16:30:14