【发布时间】:2020-01-27 18:02:53
【问题描述】:
我正在 Angular2 上编辑页面,如下图所示。过渡之间存在高度差异,这对我不利。
如何通过响应式固定高度以及如何更改尺寸custom-control(切换/切换)?
<ng-container *ngIf="!edit; then thenTemplate; else elseTemplate"></ng-container>
<ng-template #thenTemplate>
<div class="row col-12" *ngIf="header && value != null ">
<strong class="col-xs-12 col-md-4">{{header}}</strong>
<p class="col-xs-12 col-md-8">{{onValue == value ? onText : offText}}</p>
</div>
</ng-template>
<ng-template #elseTemplate>
<div class="row col-12" *ngIf="header">
<strong class="col-xs-12 col-md-4">{{header}}</strong>
<div class="col-xs-12 col-md-8 custom-control custom-switch ">
<!-- if add thiss works normaly style="height:2.5rem"-->
<input type="checkbox" class="custom-control-input" id="{{key}}" (change)="onValueChanged($event)" [ngModel]="onValue">
<label class="custom-control-label" for="{{key}}">{{onValue == value ? onText : offText}}</label>
</div>
</div>
</ng-template>
【问题讨论】:
-
尝试在输入类型复选框中添加表单控件,然后从中删除边框,或者请提供 plunker 以便我们进行测试
-
@Aarsh 添加了插件
标签: css angular bootstrap-4