Skip to content

Commit

Permalink
Starting in viewer image BenjaminBrandmeier#26 - Added parameter that…
Browse files Browse the repository at this point in the history
… opens viewer on first image when the gallery is first loaded or if the user changes gallery. Also updated README to include Parameter.
  • Loading branch information
Conork23 committed Jun 2, 2017
1 parent 3ada0ff commit b477f8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ Additional optional parameter to support multiple galleries. Add it if you want
[flexBorderSize]="3"
[flexImageSize]="7"
[galleryName]="'yourGalleryName'"
(viewerChange)="yourNotificationFunction($event)">
(viewerChange)="yourNotificationFunction($event)"
[startInViewer]=false>
</gallery>
```

Expand Down
6 changes: 6 additions & 0 deletions src/app/gallery/gallery.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export class GalleryComponent implements OnInit, OnDestroy, OnChanges {
@Input('flexImageSize') providedImageSize: number = 7
@Input('galleryName') providedGalleryName: string = ''
@Input('metadataUri') providedMetadataUri: string = undefined
@Input('startInViewer') providedStartInViewer: boolean = false;


@Output() viewerChange = new EventEmitter<boolean>()

Expand Down Expand Up @@ -92,6 +94,10 @@ export class GalleryComponent implements OnInit, OnDestroy, OnChanges {
// twice, single leads to different strange browser behaviour
this.render()
this.render()
if(this.providedStartInViewer ){
this.openImageViewer(this.images[0]);
}

},
err => this.providedMetadataUri ?
console.error("Provided endpoint '"+this.providedMetadataUri+"' did not serve metadata correctly or in the expected format. \n\nSee here for more information: https://github.com/BenjaminBrandmeier/angular2-image-gallery/blob/master/docs/externalDataSource.md,\n\nOriginal error: " + err) :
Expand Down

0 comments on commit b477f8e

Please sign in to comment.