Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript [Undeterminate]属性在角材质组件中究竟起什么作用?_Javascript_Angular_Typescript - Fatal编程技术网

Javascript [Undeterminate]属性在角材质组件中究竟起什么作用?

Javascript [Undeterminate]属性在角材质组件中究竟起什么作用?,javascript,angular,typescript,Javascript,Angular,Typescript,我已经使用了一些组件,并且有一个名为[不确定]的属性,我已经在web上搜索过,但是没有很好的解释它到底做什么。那么,你能告诉我在下面的例子中它是做什么的吗 <section class="example-section"> <mat-checkbox class="example-margin">Check me!</mat-checkbox> <mat-checkbox class="examp

我已经使用了一些组件,并且有一个名为
[不确定]
的属性,我已经在web上搜索过,但是没有很好的解释它到底做什么。那么,你能告诉我在下面的例子中它是做什么的吗

<section class="example-section">
  <mat-checkbox class="example-margin">Check me!</mat-checkbox>
  <mat-checkbox class="example-margin" [disabled]="true">Disabled</mat-checkbox>
</section>

<section class="example-section">
  <span class="example-list-section">
    <mat-checkbox class="example-margin"
                  [checked]="allComplete"
                  [indeterminate]="someComplete()"
                  (change)="setAll($event.checked)">
      {{task.name}}
    </mat-checkbox>
  </span>
  <span class="example-list-section">
    <ul>
      <li *ngFor="let subtask of task.subtasks">
        <mat-checkbox [(ngModel)]="subtask.completed"
                      [color]="subtask.color"
                      (ngModelChange)="updateAllComplete()">
          {{subtask.name}}
        </mat-checkbox>
      </li>
    </ul>
  </span>
</section>

检查我!
残废
{{task.name}
    {{subtask.name}

不确定
意味着复选框既不是选中的,也不是未选中的,介于两者之间

从文档中可以看到,它看起来是这样的:

例如,当您有一个可以检查/取消检查的内容列表,并且这些内容与父项(例如TreeView)分组时,通常会使用此选项

如果选中了父对象的所有子对象,则会选中父对象;如果未选中其所有子对象,则会选中父对象;如果选中了其部分子对象,则会选中不确定父对象

文档中还有一个例子: