我收到以下错误:
platform.es5.js:79 Uncaught TypeError: Object(...) is not a function
at eval (platform.es5.js:79)
at eval (platform.es5.js:81)
at Object../node_modules/@angular/cdk/esm5/platform.es5.js (vendor.bundle.js:63)
at __webpack_require__ (inline.bundle.js:55)
at eval (a11y.es5.js:33)
at Object../node_modules/@angular/cdk/esm5/a11y.es5.js (vendor.bundle.js:23)
at __webpack_require__ (inline.bundle.js:55)
at eval (checkbox.es5.js:14)
at Object../node_modules/@angular/material/esm5/checkbox.es5.js (vendor.bundle.js:111)
at __webpack_require__ (inline.bundle.js:55)
Run Code Online (Sandbox Code Playgroud)
我也收到了一堆警告:
(anonymous) @ platform.es5.js:79
(anonymous) @ platform.es5.js:81
./node_modules/@angular/cdk/esm5/platform.es5.js @ vendor.bundle.js:63
__webpack_require__ @ inline.bundle.js:55
(anonymous) @ a11y.es5.js:33
./node_modules/@angular/cdk/esm5/a11y.es5.js @ vendor.bundle.js:23
__webpack_require__ @ inline.bundle.js:55
(anonymous) @ checkbox.es5.js:14
./node_modules/@angular/material/esm5/checkbox.es5.js @ vendor.bundle.js:111
__webpack_require__ @ inline.bundle.js:55
(anonymous) @ app.module.ts:3
./src/app/app.module.ts @ main.bundle.js:43
__webpack_require__ @ inline.bundle.js:55
(anonymous) …Run Code Online (Sandbox Code Playgroud) html的
<input type='file' onchange="readURL(this);" />
<img id="blah" src="http://placehold.it/180" alt="your image" />
Run Code Online (Sandbox Code Playgroud)
的CSS
img{
max-width:180px;
}
input[type=file]{
padding:10px;
background:#2d2d2d;}
Run Code Online (Sandbox Code Playgroud)
.js文件
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
document.getElementById('blah').src=e.target.result
};
reader.readAsDataURL(input.files[0]);
}
}
Run Code Online (Sandbox Code Playgroud)
我有这个代码在上传之前显示图像预览.但是我正在使用angular 5,所以我有.ts文件而不是.js.如何在角度5中执行相同操作.我还想在所有浏览器中显示图像.请帮忙.提前致谢.
我有以下表格。我想强制使用图表类型。但是,仅当图形是条形图或折线图而不是饼图或圆环图时,才应强制指定 X 轴和 Y 轴值。根据我的代码,X 轴和 Y 轴值始终是强制性的。请帮忙。
html
<form [formGroup]="clientForm" (ngSubmit)="clientForm.valid && changeGraph()" #formLogin="ngForm">
<div class="form-group">
<label> Graph Type </label>
<select class="form-control" formControlName="type">
<option disabled [ngValue]="null"> Select Option </option>
<option *ngFor='let t of types' [ngValue]="t"> {{t}} </option>
</select>
<div class="form-err" *ngIf="(clientForm.controls['type'].hasError('required') && clientForm.controls['type'].touched) || (clientForm.controls['type'].hasError('required') && formLogin.submitted)"> Please enter Graph Type </div>
</div>
<div class="form-group">
<label> X-Axis </label>
<select class="form-control" formControlName="xAxis">
<option disabled [ngValue]="null"> Select Option </option>
<option *ngFor='let dim of dimensions?.data' [ngValue]="dim"> {{dim}} </option>
</select>
<div class="form-err" *ngIf="(clientForm.controls['xAxis'].hasError('required') …Run Code Online (Sandbox Code Playgroud)