簡體   English   中英

AngularJS uib-typeahead似乎中斷了頁面其余部分的插值

[英]AngularJS uib-typeahead appears to break interpolation for rest of page

我遇到了AngularJS 1.50的問題。 在以下代碼之后,插值將停止工作。

<input type="text" class="form-control" id="search" name="search" 
       placeholder="{{ shouldInterpolateButDoesnt }}" 
       typeahead-on-select="aGreatFunction($item)"
       ng-model="selectedDog" 
       uib-typeahead="dog.label for dog in dogList | filter:$viewValue" typeahead-min-length="1"/>

在呈現的HTML頁面上,占位符完整顯示{{}} 此外,此點之后的所有插值也會中斷。

如果我從頁面中刪除此行,則所有將來的插值都將再次起作用。

我想我已經將問題縮小到uib-typeahead因為如果我從上面的代碼中刪除此單個屬性,則所有插值均有效。

我嘗試按照這篇文章更改模型值: 使用ng-repeat的uib-typeahead不能持久化模型 現在,我真的不知所措。

控制台引發以下錯誤:

angular.js:13236 TypeError: Cannot read property 'exp' of undefined
    at watchFnToHumanReadableString (<anonymous>:703:19)
    at Scope.$delegate.__proto__.$watch (<anonymous>:735:28)
    at new <anonymous> (http://localhost:9000/assets/lib/angular-ui-bootstrap/ui-bootstrap-tpls.js:6318:19)
    at Object.invoke (http://localhost:9000/assets/lib/angularjs/angular.js:4604:19)
    at extend.instance (http://localhost:9000/assets/lib/angularjs/angular.js:9855:34)
    at nodeLinkFn (http://localhost:9000/assets/lib/angularjs/angular.js:8927:34)
    at compositeLinkFn (http://localhost:9000/assets/lib/angularjs/angular.js:8226:13)
    at compositeLinkFn (http://localhost:9000/assets/lib/angularjs/angular.js:8229:13)
    at nodeLinkFn (http://localhost:9000/assets/lib/angularjs/angular.js:8973:24)
    at compositeLinkFn (http://localhost:9000/assets/lib/angularjs/angular.js:8226:13) <div class="col-sm-12 col-md-12 main ng-scope" ui-view="content">

解決了問題。 在閱讀每個人對我的原始帖子的評論后,我進入控制器以尋找缺少的exp屬性。

不在那里

我搜索了Cannot read property 'exp' of undefined錯誤的Cannot read property 'exp' of undefined找到了這個github頁面 其他人也有類似的問題,許多人說禁用Batarang擴展程序可以解決此問題。 一位用戶發布了一個屏幕快照,該屏幕快照顯示他取消了Chrome開發者控制台中的“ Enable按鈕。

我試過了,但是沒有用。

要解決此問題,必須轉到chrome://extensions並從那里禁用Batarang。

這解決了問題,但有點不令人滿意。 我擔心具有Batarang擴展名的最終用戶還會看到顯示所需插值的頁面。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM