angular.js - ng-show 表達式動態顯示
問題描述
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>!支持中文、字母、數字、“-”“_”的組合,4-20個字符</span></p> </p></form>
具體效果見下
當我點擊搜索框時,提示內容顯示
求指導,謝謝
問題解答
回答1:ng-blur和ng-focus的表達式寫反了吧?還有變量里邊有必要加入$blured么?隨便一個變量都能標記是否獲得焦點吧,你再看看。
相關文章:
1. lucene - java web 現在做搜索功能,用什么比較好呢2. vue.js - npm run dev報錯了,不知道是不是node.js或者npm installed的版本問題3. 求救一下,用新版的phpstudy,數據庫過段時間會消失是什么情況?4. PHP類屬性聲明?5. javascript - vue引入微信jssdk 配置在哪個生命周期調取接口配置?6. javascript - 這種效果是輪播的效果嗎??沒有思路,求解釋。謝謝大家7. objective-c - ios百度地圖定位問題8. 跟著課件一模一樣的操作使用tp6,出現了錯誤9. php laravel框架模型作用域10. 在應用配置文件 app.php 中找不到’route_check_cache’配置項
