class FileController { file: File; extension: string; name: string; size: string; date: Date; onDelete: (args: any) => void; $onInit() { this.extension = this.file.name.split('.').pop().toLowerCase(); this.name = this.file.name; let sizeKB = this.file.size / 1024.0; let isKB = (sizeKB < 1024.0) ? true : false; this.size = (isKB) ? sizeKB.toFixed(1).toString() + ' Кб' : (sizeKB / 1024.0).toFixed(2).toString() + ' Мб'; this.date = this.file.lastModifiedDate; } delete(file: File) { this.onDelete({file: file}); } } export const file: angular.IComponentOptions = { controller: FileController, template: require('./file.html'), bindings: { file: '<', onDelete: '&' } };