本文整理汇总了TypeScript中@providers/utils/text.CoreTextUtilsProvider.bytesToSize方法的典型用法代码示例。如果您正苦于以下问题:TypeScript CoreTextUtilsProvider.bytesToSize方法的具体用法?TypeScript CoreTextUtilsProvider.bytesToSize怎么用?TypeScript CoreTextUtilsProvider.bytesToSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@providers/utils/text.CoreTextUtilsProvider
的用法示例。
在下文中一共展示了CoreTextUtilsProvider.bytesToSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ngOnInit
/**
* Component being initialized.
*/
ngOnInit(): void {
this.maxSize = Number(this.maxSize); // Make sure it's defined and it's a number.
this.maxSize = !isNaN(this.maxSize) && this.maxSize > 0 ? this.maxSize : -1;
if (this.maxSize == -1) {
this.maxSizeReadable = this.translate.instant('core.unknown');
} else {
this.maxSizeReadable = this.textUtils.bytesToSize(this.maxSize, 2);
}
if (typeof this.maxSubmissions == 'undefined' || this.maxSubmissions < 0) {
this.maxSubmissionsReadable = this.translate.instant('core.unknown');
this.unlimitedFiles = true;
} else {
this.maxSubmissionsReadable = String(this.maxSubmissions);
}
if (this.acceptedTypes && this.acceptedTypes.trim()) {
this.fileTypes = this.fileUploaderProvider.prepareFiletypeList(this.acceptedTypes);
}
}