在 angular 中创建部分视图以显示数据

Create Partial view in angular to show data

提问人:Marduk 提问时间:11/16/2023 更新时间:11/16/2023 访问量:15

问:

首先,我要说的是,这是我第一次尝试 Angular,很多概念对我来说不是很清楚,但我正在努力理解

我有这个观点:

<div class="main-container" *arLoading="loading">
  <div class="content-container">
    <div class="content-title" ngClass.lt-md="mobile-content-title"><h2>VIEWING AND ACCEPTING THE QUESTIONNAIRE</h2></div>
    <div class="inner-content">

      <ng-container>
        <p>Enter your personal code to view the questionnaire</p>
        <form fxLayout="column"
              #formcontrol="ngForm"
              [formGroup]="form"
              (ngSubmit)="verifyCode()">
          <div fxLayout="row">
            <mat-form-field fxFlex>
              <input matInput
                     formControlName="code"
                     placeholder="Personal code"
                     required />
            </mat-form-field>
          </div>
        </form>
        <br />
        <div fxLayout="row">
          <mat-label fxFlex="100">Questions and answers</mat-label>
          <div *ngFor="let request of questionnaireToView.requests">
            <!--start--><mat-label fxFlex="100">{{ request.text }}:{{ request.description }}</mat-label>
            <div *ngFor="let answer of request.risposte">
              <mat-label fxFlex="100">{{answer.description}}</mat-label>
            </div>
            <div *ngFor="let complementaryQuestion of request.complementaryQuestions">
              <!--Here I should repeat the lines in a loop or those commented between start and end-->
            </div><!--end-->
          <p>
            <mat-radio-group [(ngModel)]="acceptance">
              <mat-radio-button value="true" checked style="margin-right: 10px;">The answers are correct, I accept</mat-radio-button>
              <mat-radio-button value="false">The answers are incorrect, I refuse</mat-radio-button>
            </mat-radio-group>
          </p>
          <div fxLayout="row" fxLayoutAlign="end">
            <button class="ar-button" type="button" fxFlex="10" fxFlex.xs="100" fxFlex.sm="100" (click)="confirmAcceptance()" mat-flat-button>Confirm</button>
          </div>
        </div>
      </ng-container>
    </div>
  </div>
</div>

如果我面对 asp.net mvc 和 cshtml 文件中的项目,我会将所有内容放在一个部分中,在我称之为最后一个循环中,在 Angular 中是否有类似的事情?

HTML 角度

评论


答: 暂无答案