angular.js - ng-show 表達式動態(tài)顯示
問題描述
form input輸入框點擊搜索框顯示提示內容,點擊其他地方,提示內容消失
代碼見下
<form name='checkForm'> <p class='form-group'><label class='col-sm-3 control-label'>用 戶 名</label><p class='col-sm-8 account'> <input type='text' placeholder='您的賬戶名和登錄名'ng-model='account'name='account'required='required'ng-pattern='regularList.account'ng-blur='checkForm.account.$blured = true;'ng-focus='checkForm.account.$blured = false;'autocomplete='off'/> <span ng-class='{’right’:(checkForm.account.$error.pattern),’error’:checkForm.account.$valid}'></span></p> </p> <p ng-show='checkForm.account.$blured'><p class='input-tip'> <i></i> <span>!支持中文、字母、數(shù)字、“-”“_”的組合,4-20個字符</span></p> </p></form>
具體效果見下
當我點擊搜索框時,提示內容顯示
求指導,謝謝
問題解答
回答1:ng-blur和ng-focus的表達式寫反了吧?還有變量里邊有必要加入$blured么?隨便一個變量都能標記是否獲得焦點吧,你再看看。
相關文章:
1. docker-compose中volumes的問題2. javascript - node安裝后,npm老是報不是內部命令,如何解決呢?3. .......4. 數(shù)據(jù)庫 - 使用讀寫分離后, MySQL主從復制延遲會導致讀不到數(shù)據(jù)嗎?5. CSS3的漸變屬性的疑惑6. python如何設置一個隨著系統(tǒng)時間變化的動態(tài)變量?7. javascript - 為什么js代碼后面報錯,會導致前面的代碼執(zhí)行不了,我確定后面的部分和前面的部分沒有邏輯上的關聯(lián)。8. docker綁定了nginx端口 外部訪問不到9. 就一臺服務器,mysql數(shù)據(jù)庫想實現(xiàn)自動備份,如何設計?10. 請問一下,圖片上傳成功,但是后臺對應文件夾里面卻沒有圖片,這是什么原因?(已部署到服務器)
