如何通过单击按钮清除Angular Material Datepicker?
我试过.date .value .clear .reset .resetDate
他们似乎都没有清除Datepicker.
HTML:
<mat-form-field>
<input matInput [matDatepicker]="fromDatePicker" placeholder="From Date" disabled>
<mat-datepicker-toggle matSuffix [for]="fromDatePicker"></mat-datepicker-toggle>
<mat-datepicker #fromDatePicker disabled="false"></mat-datepicker>
</mat-form-field>
<mat-form-field>
<input matInput [matDatepicker]="toDatePicker" placeholder="To Date" disabled>
<mat-datepicker-toggle matSuffix [for]="toDatePicker"></mat-datepicker-toggle>
<mat-datepicker #toDatePicker disabled="false"></mat-datepicker>
</mat-form-field>
<button mat-raised-button (click)="resetForm()">Reset</button>
Run Code Online (Sandbox Code Playgroud)
打字稿:
@ViewChild('fromDatePicker') fromDate: any;
@ViewChild('toDatePicker') toDate: any;
resetForm() {
this.searchString.nativeElement.value = "";
this.fromDate.value = undefined;
this.fromDate.date = null;
this.toDate.date = undefined;
};
Run Code Online (Sandbox Code Playgroud) 我正在开发我的第一个 Angular 7 库,但是在尝试编译该库时收到此错误。
错误:错误 TS6059:文件“...environment.ts”不在“rootDir”“my-angular-library\projects\my-library\src”下。“rootDir”预计包含所有源文件。
看着我的树,我有:
-projects
-my-library
-src
-src
- environments
Run Code Online (Sandbox Code Playgroud)
在我的课堂上,我有以下导入:
import { environment } from "src/environments/environment";
Run Code Online (Sandbox Code Playgroud)
我正在检查其他线程,他们提到了打字稿中的错误,但是我正在运行最新版本的“打字稿”:“〜3.1.1”。
其他线程提到了错误配置的 rootDir。我检查了我的项目,没有在任何配置文件中定义 rootDir。
我不需要向项目添加环境,对吗?
连接的最简单方法是什么。NET Web应用程序到Oracle 11g数据库?EntityFramework可以立即解决此问题吗?还是我需要Oracle的某种排序或ODBC插件?
*我是在锁定环境中运行的,因此我目前无法真正测试任何一种情况。
我目前正在运行VS2010,但是我正在查看它们是否可以让我与VS2013一起运行(无nuget)。
我错过了什么?我验证了我的API正在返回数据但是我无法将数据显示在我的表中.
验证数据:
<pre>{{ myData| json }}</pre>
Run Code Online (Sandbox Code Playgroud)
HTML
<div *ngIf="dataSource">
<mat-table [dataSource]='dataSource'>
<ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef> Name </mat-header-cell>
<mat-cell *matCellDef="let df"> {{df.name}} </mat-cell>
</ng-container>
<ng-container matColumnDef="path">
<mat-header-cell *matHeaderCellDef> Path </mat-header-cell>
<mat-cell *matCellDef="let df"> {{df.path}} </mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="columnsToDisplay"></mat-header-row>
<mat-row *matRowDef="let df; columns: columnsToDisplay"></mat-row>
</mat-table>
</div>
Run Code Online (Sandbox Code Playgroud)
打字稿:
export class HomeComponent implements OnInit {
columnsToDisplay = ['name', 'path'];
myData: IMyData[];
dataSource = new MatTableDataSource<IMyData>(this.myData);
constructor(private myDataService: MyDataService) {
console.log("IN CONSTRUCTOR");
}
ngOnInit(): void {
this.myDataService.getData()
.subscribe(x => this.myData = x,
error => console.log("Error …Run Code Online (Sandbox Code Playgroud) 我不确定为什么会收到错误消息:“必须是可还原节点”
这是我的查询。我正在使用EF Core 2.2运行Core 2(因此我应该拥有以前版本中的修复程序)
IQueryable<Gizmo> gizmos = _context.Gizmo;
IQueryable<GizmoViewModel> dataReferences = (
gizmos.SelectMany(j => j.DataReferences.Select(r =>
new GizmoViewModel()
{
GizmoId = j.Id,
DataId = r.DataId
}
))
);
Run Code Online (Sandbox Code Playgroud)