本文整理汇总了TypeScript中ng-jhipster.JhiDataUtils类的典型用法代码示例。如果您正苦于以下问题:TypeScript JhiDataUtils类的具体用法?TypeScript JhiDataUtils怎么用?TypeScript JhiDataUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JhiDataUtils类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: setFileData
setFileData(event, post, field, isImage) {
if (event && event.target.files && event.target.files[0]) {
const file = event.target.files[0];
if (isImage && !/^image\//.test(file.type)) {
return;
}
this.dataUtils.toBase64(file, (base64Data) => {
post[field] = base64Data;
post[`${field}ContentType`] = file.type;
});
}
}
示例2: Promise
return new Promise((resolve, reject) => {
if (event && event.target && event.target.files && event.target.files[0]) {
const file = event.target.files[0];
if (isImage && !/^image\//.test(file.type)) {
reject(`File was expected to be an image but was found to be ${file.type}`);
} else {
const filedContentType: string = field + 'ContentType';
this.dataUtils.toBase64(file, base64Data => {
this.editForm.patchValue({
[field]: base64Data,
[filedContentType]: file.type
});
});
}
} else {
reject(`Base64 data was not set as file could not be extracted from passed parameter: ${event}`);
}
}).then(
示例3: openFile
openFile(contentType, field) {
return this.dataUtils.openFile(contentType, field);
}
示例4: byteSize
byteSize(field) {
return this.dataUtils.byteSize(field);
}
示例5: clearInputImage
clearInputImage(field: string, fieldContentType: string, idInput: string) {
this.dataUtils.clearInputImage(this.valueStream, this.elementRef, field, fieldContentType, idInput);
}
示例6: setFileData
setFileData(event, entity, field, isImage) {
this.dataUtils.setFileData(event, entity, field, isImage);
}