Angularjs 如何使用角函数应用三元类(ng类)?
我正在创建一个表单验证,我学习了如何做一些简单的验证工作,我可以得到错误并显示一些错误消息。现在,如果文本输入正确,我想显示一些样式 以下是我的一些代码:Angularjs 如何使用角函数应用三元类(ng类)?,angularjs,twitter-bootstrap,Angularjs,Twitter Bootstrap,我正在创建一个表单验证,我学习了如何做一些简单的验证工作,我可以得到错误并显示一些错误消息。现在,如果文本输入正确,我想显示一些样式 以下是我的一些代码: <div class="form-group col-md-12" ng-class="{'has-error': noteForm.c_subject.$invalid && noteForm.c_subject.$touched }"> 如果没有错误,我想应用has success类。我该怎么做呢?你就不
<div class="form-group col-md-12" ng-class="{'has-error': noteForm.c_subject.$invalid && noteForm.c_subject.$touched }">
如果没有错误,我想应用
has success
类。我该怎么做呢?你就不能把条件颠倒过来吗?可以使用以下语法链接ng类中的类:
<div class="form-group col-md-12"
ng-class="{'has-error': noteForm.c_subject.$invalid && noteForm.c_subject.$touched,
'has-success': !noteForm.c_subject.$invalid || !noteForm.c_subject.$touched }">
你就不能把条件颠倒过来吗?可以使用以下语法链接ng类中的类:
<div class="form-group col-md-12"
ng-class="{'has-error': noteForm.c_subject.$invalid && noteForm.c_subject.$touched,
'has-success': !noteForm.c_subject.$invalid || !noteForm.c_subject.$touched }">
你就不能把条件颠倒过来吗?可以使用以下语法链接ng类中的类:
<div class="form-group col-md-12"
ng-class="{'has-error': noteForm.c_subject.$invalid && noteForm.c_subject.$touched,
'has-success': !noteForm.c_subject.$invalid || !noteForm.c_subject.$touched }">
你就不能把条件颠倒过来吗?可以使用以下语法链接ng类中的类:
<div class="form-group col-md-12"
ng-class="{'has-error': noteForm.c_subject.$invalid && noteForm.c_subject.$touched,
'has-success': !noteForm.c_subject.$invalid || !noteForm.c_subject.$touched }">
更新
ng-class="{'has-error': noteForm.c_subject.$invalid && noteForm.c_subject.$touched }"
到
i、 e
<div class="form-group col-md-12" ng-class ="{true: 'has-error', false: 'has-success'}[noteForm.c_subject.$invalid && noteForm.c_subject.$touched]"></div>
更新
ng-class="{'has-error': noteForm.c_subject.$invalid && noteForm.c_subject.$touched }"
到
i、 e
<div class="form-group col-md-12" ng-class ="{true: 'has-error', false: 'has-success'}[noteForm.c_subject.$invalid && noteForm.c_subject.$touched]"></div>
更新
ng-class="{'has-error': noteForm.c_subject.$invalid && noteForm.c_subject.$touched }"
到
i、 e
<div class="form-group col-md-12" ng-class ="{true: 'has-error', false: 'has-success'}[noteForm.c_subject.$invalid && noteForm.c_subject.$touched]"></div>
更新
ng-class="{'has-error': noteForm.c_subject.$invalid && noteForm.c_subject.$touched }"
到
i、 e
<div class="form-group col-md-12" ng-class ="{true: 'has-error', false: 'has-success'}[noteForm.c_subject.$invalid && noteForm.c_subject.$touched]"></div>
为什么不使用angular的ng valid
类?它会自动应用OK我会搜索它我还在学习。:)如果没有错误,noteForm.c_subject.$valid
将为真。为什么不使用angular的ng valid
类?它会自动应用OK我会搜索它我还在学习。:)如果没有错误,noteForm.c_subject.$valid
将为真。为什么不使用angular的ng valid
类?它会自动应用OK我会搜索它我还在学习。:)如果没有错误,noteForm.c_subject.$valid
将为真。为什么不使用angular的ng valid
类?它会自动应用OK我会搜索它我还在学习。:)如果没有错误,noteForm.c_subject.$valid
将为真。