我在我的材质表中加载数据:
ngOnInit(){ return this.annuairesService.getMedecins().subscribe(res => this.dataSource.data = res);}
Run Code Online (Sandbox Code Playgroud)
我想在加载时显示微调器: <mat-spinner ></mat-spinner>
我试试:showSpinner:boolean = true;
ngOnInit(){ return this.annuairesService.getMedecins()
.subscribe(res => this.dataSource.data = res);
this.dataSource.subscribe(() => this.showSpinner = false }
Run Code Online (Sandbox Code Playgroud)
但我有这个错误:
src/app/med-list/med-list.component.ts(54,21): error TS2339: Property 'subscribe' does not exist on type 'MatTableDataSource<{}>'.
Run Code Online (Sandbox Code Playgroud) 我想用输入数据初始化我的mat芯片输入但是当我有两个芯片时,它只形成一个形式:
*.component.ts
@Component({
selector: 'app-pps-dialog',
templateUrl: './pps-dialog.component.html',
})
export class PPSDialogComponent implements OnInit {
patientid: string;
ppsForm: FormGroup;
ppssToDisplay;
visible: boolean = true;
selectable: boolean = true;
removable: boolean = true;
addOnBlur: boolean = true;
// Enter, comma
separatorKeysCodes = [ENTER, COMMA];
constructor(
private route: ActivatedRoute,
private ppssService:PPSsService,
private _changeDetectorRef: ChangeDetectorRef,
private location: Location,
private router: Router,
public dialog: MatDialog,
private formBuilder: FormBuilder,
public dialogRef: MatDialogRef<PPSDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any)
{ this.initForm(); }
ngOnInit(): void {
this.ppssToDisplay = this.ppssService.getSinglePPS(this.key)
.subscribe(res …Run Code Online (Sandbox Code Playgroud) 我有3个元素:1个工具栏,1个地图,另一个工具栏.元素是一个在另一个之下
我希望第二个工具栏停留在地图元素下(顶部的400px)但是当我向下滚动时,我的第二个工具栏将停在顶部的50px并将在第一个工具栏下修复.
谢谢你的帮助
//Component.html
<mat-toolbar color="primary" [ngStyle]="{'height':'50px'}" class="fixed-header" >
</mat-toolbar>
<div class="custom-popup" id="frugalmap" ></div>
<mat-toolbar color="warn" class="mat-elevation-z5">
</mat-toolbar>
Run Code Online (Sandbox Code Playgroud)
//Component.css
.fixed-header {
position: fixed;
z-index:999;
}
#frugalmap {
height: 300px;
width: 100%;
margin-top:50px;
}
.mat-elevation-z5 {
position: relative;
z-index: 2;
}
Run Code Online (Sandbox Code Playgroud) 我正在使用Angular CLI。而且,我想制作一个自动填充的表单,该表单可以显示所有值(不像执行“开始于”的angular.io示例一样)。
我设法使其兼容,[formControl]但我想将其插入FormGroup。因此,我认为与formControlName(同时使用formControlName和[formControl])一起使用它意味着我没有从表单中获得价值。
这是我当前的代码,过滤器上有问题。谢谢您的帮助
component.html:
<form [formGroup]="tumeurForm" (ngSubmit)="onSubmitForm()">
<mat-form-field appearance="outline">
<mat-label>Diagnostic : inscription de la tumeur</mat-label>
<input
matInput
type="text"
formControlName="localisation"
[matAutocomplete]="auto"/>
<mat-autocomplete autoActiveFirstOption #auto="matAutocomplete">
<mat-option *ngFor="let option of filteredOptions | async" [value]="option">
{{ option }}
</mat-option>
</mat-autocomplete>
</mat-form-field>
</form>
Run Code Online (Sandbox Code Playgroud)
component.ts:
export class DiagnosticDialogComponent implements OnInit {
options = [
"(C00) Néoplasie maligne de la lèvre",
"(C00.0) Lèvre supérieure, bord libre",
"(C00.1) Lèvre inférieure, bord libre"
];
patientid: string; …Run Code Online (Sandbox Code Playgroud) 我通过2 [formControl]"toppings"收听2个表单:array和"toppings2":array.
我必须同时拥有表格的2个值.所以我把我的两个观察者与"CombineLatest"结合起来
我的代码:
ngOnInit() {
combineLatest(this.toppings.valueChanges, this.toppings2.valueChanges)
.subscribe(val => console.log(val))
}
Run Code Online (Sandbox Code Playgroud)
但是现在,在组件的初始化中,只有一个表单发送console.log(val).
如果我在收到第二张表格的日志后点击此表格.你遇到这个问题吗?
我使用Angular Material和Angular6。我在材质对话框中做了很多工作,我这样做是这样的:
openDialog3(key : string): void {
let dialogRef = this.dialog.open(PPSDialogRemoveComponent, {width: '1000px'});
dialogRef.componentInstance.key = key;
}
Run Code Online (Sandbox Code Playgroud)
现在,我想使用角度材质底片。要将密钥传递给我的底部组件,请尝试以下操作:
openBottomSheet(key: string): void {
let dialogRef = this.bottomSheet.open(BottomSheetOverviewExampleSheet);
dialogRef.componentInstance.key = key;
}
Run Code Online (Sandbox Code Playgroud)
但是我有这个错误
src / app / geo / geo.component.ts(568,15)中的错误:错误TS2339:类型“ MatBottomSheetRef”上不存在属性“ componen实例”。
谢谢你的帮助
angular ×6
typescript ×2
arrays ×1
autocomplete ×1
bottom-sheet ×1
css3 ×1
datasource ×1
filter ×1
formbuilder ×1
forms ×1
javascript ×1
rxjs ×1
sass ×1
scroll ×1
spinner ×1
subscribe ×1