Created
June 19, 2018 10:47
-
-
Save Sampath-Lokuge/3100a2418f6008e1840f7f803fd76d54 to your computer and use it in GitHub Desktop.
gallery.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, Input, Injector } from '@angular/core'; | |
import { DocumentUploadServiceProxy, OriginalBlobDto } from '@shared/service-proxies/service-proxies'; | |
import { AppComponentBase } from '@shared/common/app-component-base'; | |
@Component({ | |
selector: 'gallery', | |
templateUrl: './gallery.component.html', | |
styleUrls: ['./gallery.component.css'], | |
}) | |
export class GalleryComponent extends AppComponentBase { | |
@Input() dataCollection; | |
selectedImage; | |
constructor(injector: Injector, private documentUploadService: DocumentUploadServiceProxy) { | |
super(injector); | |
} | |
setSelectedImage(image) { | |
this.documentUploadService.getOriginalBlob('', image.blobFileName, '', image.docType).subscribe((result) => { | |
this.selectedImage = result; | |
}); | |
} | |
navigate(forward) { | |
let index = this.dataCollection.indexOf(this.selectedImage) + (forward ? 1 : -1); | |
if (index >= 0 && index < this.dataCollection.length) { | |
this.selectedImage = this.dataCollection[index]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment