我通过设置仪表板的显示类型并遇到了这个问题,如何在角度中制作一个if else。
有更好的方法吗?
<div ng-if="'CONFIG.dashboard.rows == 1'" layout="column" flex>
<div ng-if="'CONFIG.dashboard.rows > 1'" layout="row" flex>
解决:
<div ng-switch on="CONFIG.dashboard.rows" flex>
<div ng-switch-when="1" layout="column" flex layout-wrap>
<div ng-repeat="wdg in CONFIG.widgets" flex='100' ng-include="wdg.template"></div>
</div>
<div ng-switch-default layout="row" flex layout-wrap>
<div ng-repeat="wdg in CONFIG.widgets" flex='50' ng-include="wdg.template"></div>
</div>
</div>