使用Angular Material,我尝试禁用手风琴中的某些扩展面板:
md-expansion-panel(https://material.angular.io/components/expansion/overview#expansion-panel-content)的Angular Material文档说:
Disabling a panel
Expansion panels can be disabled using the disabled attribute. A disabled expansion panel can't be toggled by the user, but can still be manipulated using programmatically.
<md-expansion-panel [disabled]="isDisabled"> etc...
但是当我把[禁用] =&#34; isDisabled&#34; (或&#34; true&#34;或&#34; false&#34;或其他)我收到以下错误:
未捕获错误:模板解析错误: 无法绑定到“已禁用”状态&#39;因为它不是“md-expansion-panel&#39;”的已知属性。
这是我的实际template.html代码:
<md-card>
<md-card-header><h2 md-header>Attempt to Disable Individual Expansion Panel</h2></md-card-header>
<md-card-content>
<md-accordion>
<md-expansion-panel [disabled]="isDisabled">
<md-expansion-panel-header>
<md-panel-title>
Here is the title of a panel
</md-panel-title>
</md-expansion-panel-header>
<md-panel-description>
Blah blah some descriptive text
</md-panel-description>
<p>
Here's some content just to fill out all the available blanks.
</p>
</md-expansion-panel>
</md-accordion>
</md-card-content>
</md-card>
任何想法都将不胜感激!!谢谢!
答案 0 :(得分:0)
事实证明,只要您使用的是最新版本的Angular,它确实可以正常工作。
对于其他可能需要帮助的人,以下是我检查和升级的方式:
有关详细信息,请参阅此问题:Upgrade Angular version (now: 2.4.3 or 4.0.0-beta.3) following the best practice?