AngularJS如何在初始化后更改mat字段值

时间:2017-12-18 14:58:09

标签: javascript jquery angularjs wordpress

我已经购买了一个使用角度JS来初始化表单的wordpress票证系统。

我需要在加载一些自定义数据后更改输入字段的值,但是我无法使这项工作得到开发人员的支持。我已经制作了一些插入值的jquery代码,但它没有验证表单,所以我无法进入下一步。我知道到目前为止这不是最好的方法,但是如果我设法让它无故障地工作就足够了。

这里是表单html和JS我使用



                      		jQuery('mat-form-field.ng-tns-c15-11').removeClass('mat-input-invalid').removeClass('mat-form-field-invalid').removeClass('.ng-pristine').removeClass('.ng-invalid').addClass('ng-valid').addClass('ng-dirty'); 
                      		jQuery('#mat-input-3').attr('aria-invalid','false');
                      		jQuery('#mat-input-3').removeClass('ng-pristine').removeClass('ng-invalid').removeClass('ng-touched').addClass('.ng-dirty').addClass('.ng-valid');

<div _ngcontent-c20="" fxlayout="column" fxlayoutalign="space-between none" style="box-sizing: border-box; display: flex; flex-direction: column; max-width: 100%; place-content: stretch space-between; align-items: stretch;">
   <!---->
   <mat-form-field _ngcontent-c20="" class="mat-input-container mat-form-field ng-tns-c15-4 mat-form-field-type-mat-input mat-form-field-can-float mat-primary ng-pristine ng-invalid mat-input-invalid mat-form-field-invalid ng-touched">
      <div class="mat-input-wrapper mat-form-field-wrapper">
         <div class="mat-input-flex mat-form-field-flex">
            <!---->
            <div class="mat-input-infix mat-form-field-infix">
               <input _ngcontent-c20="" class="mat-input-element mat-form-field-autofill-control ng-pristine ng-invalid ng-touched" matinput="" type="text" required="" id="mat-input-3" placeholder="Kontrollschild" aria-invalid="true">
               <span class="mat-input-placeholder-wrapper mat-form-field-placeholder-wrapper">
                  <!---->
                  <label class="mat-input-placeholder mat-form-field-placeholder ng-tns-c15-4 mat-empty mat-form-field-empty" for="mat-input-3" aria-owns="mat-input-3">
                     Kontrollschild <!----><span aria-hidden="true" class="mat-placeholder-required mat-form-field-required-marker ng-tns-c15-4">*</span>
                  </label>
               </span>
            </div>
            <!---->
         </div>
         <div class="mat-input-underline mat-form-field-underline"><span class="mat-input-ripple mat-form-field-ripple"></span></div>
         <div class="mat-input-subscript-wrapper mat-form-field-subscript-wrapper">
            <!----><!---->
            <div class="mat-input-hint-wrapper mat-form-field-hint-wrapper ng-tns-c15-4 ng-trigger ng-trigger-transitionMessages" style="opacity: 1; transform: translateY(0%);">
               <!---->
               <div class="mat-input-hint-spacer mat-form-field-hint-spacer"></div>
            </div>
         </div>
      </div>
   </mat-form-field>
   <!---->
   <!---->
   <!---->
</div>
&#13;
&#13;
&#13;

0 个答案:

没有答案