angular.js - ng-show 表達式動態(tài)顯示
問題描述
form input輸入框點擊搜索框顯示提示內(nèi)容,點擊其他地方,提示內(nèi)容消失
代碼見下
<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>
具體效果見下
當(dāng)我點擊搜索框時,提示內(nèi)容顯示
求指導(dǎo),謝謝
問題解答
回答1:ng-blur和ng-focus的表達式寫反了吧?還有變量里邊有必要加入$blured么?隨便一個變量都能標(biāo)記是否獲得焦點吧,你再看看。
相關(guān)文章:
1. 數(shù)據(jù)庫 - MySQL 單表500W+數(shù)據(jù),查詢超時,如何優(yōu)化呢?2. python - Django分頁和查詢參數(shù)的問題3. 求大神幫我看看是哪里寫錯了 感謝細(xì)心解答4. MySQL客戶端吃掉了SQL注解?5. android - Windows系統(tǒng)下運行react-native App時,報下面的錯誤?6. javascript - 圖片能在網(wǎng)站顯示,但控制臺仍舊報錯403 (Forbidden)7. php自學(xué)從哪里開始?8. mysql - AttributeError: ’module’ object has no attribute ’MatchType’9. javascript - JS設(shè)置Video視頻對象的currentTime時出現(xiàn)了問題,IE,Edge,火狐,都可以設(shè)置,反而chrom卻...10. phpstady在win10上運行
