问题描述
我在这里有一个奇怪的情况。我在有角度的网页上有一个选择控件。它在本地环境中正确显示。 但是,当我将其发布到Azure时,select控件无法正确显示。
这是在Azure网站上显示的。
这是对Azure网站上的选择控件的检查。可以看出,选择控件为空。
这是用于选择控件的html,我创建了一个用于自定义显示的组件。
<div class="dynamic-field row" [formGroup]="group">
<label class="col-form-label" [ngClass]="'col-'+config.labelSize" *ngIf="config.labelSize!==0">{{ config.label }}</label>
<div [ngClass]="'col-'+ (12 - (config.labelSize||0))">
<div class="input-group input-group-sm">
<div class="input-group-prepend" *ngIf="config.prepend">
<span class="input-group-text" *ngIf="!config.prependConfig" [innerHTML]="config.prepend"></span>
<span class="input-group-text cursor-pointer" *ngIf="config.prependConfig" cspsDynamicFormModalLink [innerHTML]="config.prepend"
[config]="config.prependConfig"></span>
</div>
<select [formControlName]="config.name" class="form-control">
<option [ngValue]="undefined" *ngIf="config.placeholder">{{ config.placeholder }}</option>
<option [ngValue]="option.key" *ngFor="let option of options">
{{ option.value }}
</option>
</select>
<div class="input-group-append" *ngIf="config.append">
<span class="input-group-text" *ngIf="!config.appendConfig" [innerHTML]="config.append"></span>
<span class="input-group-text cursor-pointer" *ngIf="config.appendConfig" cspsDynamicFormModalLink [innerHTML]="config.append"
[config]="config.appendConfig"></span>
</div>
</div>
</div>
</div>
这是ts文件:
@Component({
selector: 'form-select',templateUrl: 'form-select.component.html',styleUrls: ['form-select.component.css']
})
export class FormSelectComponent implements Field,OnInit {
config: FieldConfig;
group: FormGroup;
options: { key: any,value: string }[];
ngOnInit() {
const sorter = {
asc: (a: { value: string },b: { value: string }) => { return a.value === b.value ? 0 : (a.value > b.value ? 1 : -1) },desc: (a: { value: string },b: { value: string }) => { return a.value === b.value ? 0 : (a.value < b.value ? 1 : -1) },none: undefined
}
this.config.sortOptions = this.config.sortOptions || 'none';
if (this.config.options)
this.options = this.config.options.sort(sorter[this.config.sortOptions]);
else
this.options = [];
}
}
有人可以给我一些建议吗?或告诉我发生了什么事? 谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)