我试图按照这篇文章Angular flex-layout with ngFor来做我想做的事,但我做不到。
我有这个代码:
<div *ngFor="let room of listRoom;">
<div class="room">
Room {{room.label}}
<div *ngFor="let bed of room.beds;">
<div class="bed">
Bed #{{bed.label}}
<button mat-raised-button color="accent" (click)="assignThisBed(bed)">
Assign this bed
</button>
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我的listRooms元素通常在 10-15 个元素之间,我想连续有 3 个房间,然后是隔断线,3 个房间,......
有人能帮我吗?谢谢..
这是带有我的代码的StackBlitz。
我想知道是否有人知道如何在角度材料组件"工具提示"中跳线
这是我的代码:
HTML:
<mat-icon
[matTooltip]="getMoreInformations()"
matTooltipPosition="left">
myIcon
</mat-icon>
Run Code Online (Sandbox Code Playgroud)
TS:
getMoreInformations(): string {
return 'Adress : ' + this.person.adress
+ ' \n Tel : ' + this.person.tel;
}
Run Code Online (Sandbox Code Playgroud)
\n和br不起作用(试过两者)
还试图像这样添加一个matTooltipClass:
HTML:
<mat-icon...
matTooltipClass="test"
...
Run Code Online (Sandbox Code Playgroud)
CSS:
.test {
white-space: pre-line;
}
Run Code Online (Sandbox Code Playgroud) 我需要过滤选择的数据,因为选择太多了。我这样做是这样的:
<mat-form-field>
<mat-select placeholder="Unit.." (change)="onTabChange(element, $event.value.id, 'assignedUnit')">
<input matInput type="text" (keyup)="filterListCareUnit($event.target.value)">
<mat-option *ngFor="let careUnit of listCareUnits" [value]="careUnit">
{{ careUnit.label }}
</mat-option>
</mat-select>
</mat-form-field>
Run Code Online (Sandbox Code Playgroud)
在键上,我正在打电话 filterListCareUnit($event.target.value)
但在此功能中,我不知道使用过滤器rxjs
我有我的listCareUnits,我想删除所有不包含$event.target.value
现在,我这样做了,但显然不起作用,我的列表中总是包含相同的项目:
filterListCareUnit(val) {
console.log(val);
this.listCareUnits.filter((unit) => unit.label.indexOf(val));
}
Run Code Online (Sandbox Code Playgroud)
angular / rxjs的新手..谢谢您的帮助
我有这样的选择:
<mat-select placeholder="..." (change)="onChange($event.value)">
<mat-option *ngFor="let option of options" [value]="option.value">
{{ option }}
</mat-option>
</mat-select>
<div class="disable">
<mat-form-field>
<input matInput [matDatepicker]="picker" placeholder="Choose a date">
<mat-datepicker #picker ></mat-datepicker>
</mat-form-field>
</div>
Run Code Online (Sandbox Code Playgroud)
禁用类只是隐藏div的包含。
在我的onChange($ event)中:
onChange(value) {
if(value === 'someValue'){
openDatePicker() //How to do this ??
}
}
Run Code Online (Sandbox Code Playgroud)
如果选择了特定值,我想打开日期选择器。可以通过打字稿做到这一点吗?
感谢您的答复
在两种情况下,我需要向 Ag-grid 添加一些列。其他情况我只需要基本列。
所以在构造函数中,我像这样声明我的网格:
this.gridOption.columnDefs = [
{
headerName: 'Admission date',
field: 'admissionPlannedDate',
cellRendererFramework: DateCellRendererComponent,
cellRendererParams: (params) => {
return (params.data.admissionPlannedDate ? {dateFormat: 'dd.MM.yyyy - HH:mm'} : {dateFormat: ' '});
},
cellStyle: function (params) {
return (params.data.admissionPlannedDate < new Date() ? {color: 'red'} : {});
}
},
{
headerName: 'Lastname',
field: 'lastName',
cellStyle: function (params) {
return (params.data.edsId === null ? {color: 'orange'} : {});
}
},
},
{
headerName: 'Sex',
field: 'sex',
},
{
headerName: 'Birthdate',
field: 'birthDate',
cellRendererFramework: …Run Code Online (Sandbox Code Playgroud)