Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/31.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
Angular 如何禁用<;md扩展面板>;材料2角度2_Angular_Typescript_Angular Material_Angular2 Template - Fatal编程技术网

Angular 如何禁用<;md扩展面板>;材料2角度2

Angular 如何禁用<;md扩展面板>;材料2角度2,angular,typescript,angular-material,angular2-template,Angular,Typescript,Angular Material,Angular2 Template,我面临一些关于材料设计官方文件的问题, 他们说 可以使用disabled属性禁用扩展面板。用户无法切换已禁用的扩展面板,但仍可以使用编程方式对其进行操作。 <mat-expansion-panel [disabled]="isDisabled"> <mat-expansion-panel-header> This is the expansion title </mat-expansion-panel-header> <mat-pan

我面临一些关于材料设计官方文件的问题, 他们说

可以使用disabled属性禁用扩展面板。用户无法切换已禁用的扩展面板,但仍可以使用编程方式对其进行操作。

<mat-expansion-panel [disabled]="isDisabled">
  <mat-expansion-panel-header>
    This is the expansion title
  </mat-expansion-panel-header>
  <mat-panel-description>
    This is a summary of the content
  </mat-panel-description>
</mat-expansion-panel>

这是扩展标题
这是内容的摘要
但当我尝试它时,抛出了一些错误-

Uncaught Error: Template parse errors:
Can't bind to 'disabled' since it isn't a known property of 'md-expansion-panel'.
1. If 'md-expansion-panel' is an Angular component and it has 'disabled' input, then verify that it is part of this module.
2. If 'md-expansion-panel' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("

            <md-expansion-panel
            [ERROR ->][disabled]="true"

               routerLink="/settings/tools"
")
未捕获错误:模板分析错误:
无法绑定到“disabled”,因为它不是“md扩展面板”的已知属性。
1.如果“md扩展面板”是一个角度组件,并且具有“禁用”输入,则验证它是否是该模块的一部分。
2.如果“md expansion panel”是Web组件,则将“CUSTOM_ELEMENTS_SCHEMA”添加到此组件的“@NgModule.schemas”以抑制此消息。
3.若要允许任何属性,请将“无错误模式”添加到此组件的“@NgModule.schemas”。("
][禁用]=“真”
routerLink=“/settings/tools”
")

有什么帮助吗?

当我查看mat扩展面板代码(
选择器:'mat扩展面板'
)时,我看到它确实已禁用作为其输入之一(
输入:['disabled','expanded']
),但我没有看到它被使用

我是否可以建议一种解决方法:在mat扩展面板上设置
指针事件:无


<mat-expansion-panel [disabled]="isDisabled">
  <mat-expansion-panel-header>
    This is the expansion title
  </mat-expansion-panel-header>
  <mat-panel-description>
    This is a summary of the content
  </mat-panel-description>
</mat-expansion-panel>
这是扩展标题 这是内容的摘要
组件技术

禁用设置值-此.isDisabled=true


启用设置值-此.isDisabled=false

“disabled”是一个已定义的属性,可直接禁用扩展面板上的用户交互。直接设置属性以禁用任何面板

<mat-expansion-panel disabled>
  <mat-expansion-panel-header>
    This is the expansion title
  </mat-expansion-panel-header>
  <mat-panel-description>
    This is a summary of the content
  </mat-panel-description>
</mat-expansion-panel>

这是扩展标题
这是内容的摘要
要以编程方式禁用该面板,请参阅下面的代码段,该代码段适用于我。
注意应计算为true或false

<mat-expansion-panel [disabled]="<CONDITION>">
  <mat-expansion-panel-header>
    This is the expansion title
  </mat-expansion-panel-header>
  <mat-panel-description>
    This is a summary of the content
  </mat-panel-description>
</mat-expansion-panel>

这是扩展标题
这是内容的摘要

能否更新您的问题以显示角度版本和角度材质版本?