角材料步进器不再工作

时间:2020-08-03 09:47:21

标签: angular stepper

我最近一直在尝试将项目部署到生产环境,因此,我一直在使用angular.json baseHref值和deployUrl值。我还添加了HashLocationStrategy,以使Web在Apache服务器中正常显示,因为没有其他方法可以使其正常工作。 (我之所以这样说,是因为我不知道这是否会影响到项目的功能。)

现在,即使在开发人员模式下,该问题仍在发生。我有一个步进器正在工作,由于某些原因,方法stepper.next()stepper.previous()stepper.reset()无效。

签名并发送.component.html

    <mat-horizontal-stepper [linear]="true" #stepper class="stepper_custom">
  <mat-step [stepControl]="firstFormGroup" required>
    <ng-template matStepLabel>Carga un PDF</ng-template>
    <div class="Hflex">
    <mat-form-field style="width: 50vw;">
      <mat-label>Cargar archivo PDF</mat-label>
      <ngx-mat-file-input
        appearance="outline"
        placeholder="Cargar archivo PDF"
        [accept]="'.pdf'"
        (change)="load_pdf($event)"
        required
      ></ngx-mat-file-input>
      <mat-icon matSuffix>folder</mat-icon>
    </mat-form-field>
    <button type="button" mat-raised-button color="primary" (click)="stepper.next()">Continuar<mat-icon>play_arrow</mat-icon></button>
    </div>
  </mat-step>
  <mat-step [stepControl]="secondFormGroup">
    <ng-template matStepLabel>Elige sello</ng-template>
    <div class="Hflex">
      <button type="button" mat-raised-button color="primary" (click)="stepperForward(stepper)"><mat-icon class="backwards">play_arrow</mat-icon>Opción previa</button>
    <mat-form-field color="primary">
      <mat-label>Elige Sello</mat-label>
      <mat-select [(value)]="selloElegido"
      (selectionChange)="add_sello(add_image)"
      [disabled]="sellos_disabled">
        <mat-option value="f">Ferretería
          <img width="50%" height="50%" src="../../../assets/img/SelloFerre.png"/>
        </mat-option>
        <mat-option value="c"
          >Cerámicas
          <img
            width="50%"
            height="50%"
            src="../../../assets/img/SelloCeram.png"
          />
        </mat-option>
      </mat-select>
   </mat-form-field>

  <mat-checkbox [(ngModel)]="firmado" checked=true color="primary" (change)="add_sello(add_image)" [disabled]="firmado_disabled">Añadir mi firma</mat-checkbox>
  <button type="button" mat-raised-button color="primary" (click)="stepper.next()">Continuar<mat-icon>play_arrow</mat-icon></button>
  </div>

  </mat-step>
  <mat-step [stepControl]="thirdFormGroup">
    <ng-template matStepLabel>Elige qué hojas firmar</ng-template>
    <div class="Hflex">
      <button type="button" mat-raised-button color="primary" (click)="stepper.previous()"><mat-icon class="backwards">play_arrow</mat-icon>Opción previa</button>
    <mat-radio-group
  color="primary"
  class="radio-group"
  [(ngModel)]="hojas_firmada_elegida"
  (change)="add_sello(add_image)">
  <mat-radio-button class="hojas_firmar_radio-button" *ngFor="let tipo of hojas_firmadas" [value]="tipo">
    {{tipo}}
  </mat-radio-button>
</mat-radio-group>
<button type="button" mat-raised-button color="primary" (click)="stepper.next()">Continuar<mat-icon>play_arrow</mat-icon></button>
</div>
  </mat-step>
  <mat-step [stepControl]="fourthFormGroup">
    <ng-template matStepLabel>Enviar por correo electrónico</ng-template>
    <div class="Hflex">
      <button type="button" mat-raised-button color="primary" (click)="stepper.previous()"><mat-icon class="backwards">play_arrow</mat-icon>Opción previa</button>

    <mat-form-field color="primary" appearance="fill" style="width: 25vw;text-align:center;">
      <mat-icon matPrefix>email</mat-icon>
      <mat-label>Inserte aquí el email</mat-label>
      <input matInput type="email" [(ngModel)]="correoelectronico" />
    </mat-form-field>
     <button button type="button" mat-raised-button color="primary" class="enviarbutton" (click)="contactForm()"><div class="div1">Enviar</div><div class="div2"><mat-icon>send</mat-icon></div></button>
    <a *ngIf="fileURL" [href]="fileURL" download="file.pdf">Descarga</a>
  </div>
  </mat-step>
  <mat-step>
    <ng-template matStepLabel>Listo</ng-template>
    <p>Listo.</p>
    <div>
      <button mat-raised-button color="primary" (click)="stepper.reset()">Firmar otro PDF</button>
    </div>
  </mat-step>
</mat-horizontal-stepper>

在ts代码中,我还使用ViewChild访问步进器,如下所示:

@ViewChild('stepper',{static:true}) private myStepper: MatStepper;

所以我可以以编程方式使用this.myStepper.next();

我没有在代码中看到任何错误,我在html中将步进器标识为#stepper,并相应地使用了它。该代码可以正常工作,但是上面提到的该组件的最新更改,我不知道它们是否可以以某种方式影响组件。

0 个答案:

没有答案