【问题标题】:Angular js text clippings , text are being clipped if its more than 150 charactersAngular js文本剪辑,如果文本超过150个字符,则会被剪辑
【发布时间】:2020-08-25 03:14:39
【问题描述】:

正如您在下图中看到的,当问题超过 150 个字符时,该问题被剪裁,最好的解决方案是什么?有什么建议吗?谢谢。如果超过 150 个字符,我不希望文本或问题被剪裁。

它应该是动态的并且应该调整。

角度

<div fxLayout="row" fxLayoutGap="24px">
        <div fxFlex fxLayout="row">
          <mat-form-field appearance="outline" class="pr-4" fxFlex>
            <mat-label>Search Question</mat-label>
            <mat-chip-list #chipList>
              <mat-chip *ngIf="hasSelectedQuestion()" [selectable]="selectable" removable="true"
                (removed)="deselectQuestion()">
                {{form.controls.question.value.question}}
                <mat-icon matChipRemove>cancel</mat-icon>
              </mat-chip>
            </mat-chip-list>
            <input matInput #questionSearch [ngClass]="!hasSelectedQuestion() ? '' : 'hidden'" [matAutocomplete]="auto"
              [matChipInputFor]="chipList" formControlName="question" required class="full-width" trim />
            <mat-icon matSuffix>search</mat-icon>
            <mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn">
              <mat-option *ngFor="let question of questions$ | async" [value]="question">
                {{question.question}} <span class="disabled-text">({{question.choice ? 'Yes/No' : 'Comment only'}})
                </span>
              </mat-option>
            </mat-autocomplete>
          </mat-form-field>
        </div>
      </div>

【问题讨论】:

标签: javascript angularjs angular clipping


【解决方案1】:
<mat-chip-list>
      <!-- Height auto allows the content to grow as per content -->
      <mat-chip style="width: 400px; height: auto; overflow: hidden;">

        <!-- max-height will limit grow of element after which overflow-y auto will allow scrolling -->
        <div
          style="
            margin-right: 10px;
            overflow-y: auto;
            height: auto;
            max-height: 60px;
          "
        >
          Lorem ipsum dolor sit amet, consectetur adipisicing elit. Praesentium
          rem a error obcaecati iste laborum doloribus numquam commodi
          exercitationem hic saepe non laudantium suscipit ullam, esse sequi qui
          aliquid aliquam.
        </div>
        <mat-icon style="position: absolute; right: 0;">cancel</mat-icon>
      </mat-chip>
    </mat-chip-list>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-11-23
    • 2015-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-28
    • 1970-01-01
    相关资源
    最近更新 更多