使用angularjs单击按钮时,将提交的类添加到表单输入

时间:2015-07-07 23:05:43

标签: javascript angularjs twitter-bootstrap

我使用Bootstrap,Angular JS和Angular Payments插件来创建表单并验证/格式化信用卡信息。如果在提交表单后未验证输入,我的目标是显示红色文本。我希望通过添加课程" ng-submitted"单击按钮时。

我将如何正确地做到这一点?

HTML - 我的表单的第一部分,因为我有2个部分。

public Object clone() throws CloneNotSupportedException {
    cloneobj cloned = (cloneobj)super.clone();
    cloned.name=this.name; //maybe (String)this.name.clone(); could be used
    return cloned;
}

CSS

<form name="ccform" class="ccform" ng-init="step = 1" novalidate>

              <div class="form-group">
                <div class="row form-margin">
                    <div class="col-xs-12">
                      <div ng-show="step==1" >
                        <div ng-form="step1form" class="form-style">
                          <div class="col-xs-12">
                            <label class="sr-only" for="inputCardNumber">Credit Card Number</label>
                            <input type="text" class="form-control centerfield cardlogos" name="cardnumber" ng-model="number" payments-validate="card" payments-format="card" payments-type-model="type" ng-class="ccform.number.$card.type" placeholder="0000 0000 0000 0000" required/>
                          </div>
                        </div>
                        <button class="btn add-button" ng-disabled="!step1form.$valid" ng-click="step = 2">Add card</button>
                      </div>
                    </div>
                </div>
              </div>
</form>

0 个答案:

没有答案