-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(carousel): add flags controling display of navigation arrows and…
- Loading branch information
1 parent
7eaa7e7
commit ec4e939
Showing
9 changed files
with
136 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
16 changes: 16 additions & 0 deletions
16
demo/src/app/components/carousel/demos/navigation/carousel-navigation.html
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<ngb-carousel *ngIf="images" [showNavigationArrows]="showNavigationArrows" [showNavigationIndicators]="showNavigationIndicators"> | ||
<ng-template ngbSlide *ngFor="let image of images"> | ||
<img [src]="image" alt="Random slide"> | ||
<div class="carousel-caption"> | ||
<h3>No mouse navigation</h3> | ||
<p>This carousel hides navigation arrows and indicators.</p> | ||
</div> | ||
</ng-template> | ||
</ngb-carousel> | ||
|
||
<hr> | ||
|
||
<div class="btn-group" role="group" aria-label="Carousel toggle controls"> | ||
<button type="button" (click)="showNavigationArrows = !showNavigationArrows" class="btn btn-outline-dark btn-sm">Toggle navigation arrows</button> | ||
<button type="button" (click)="showNavigationIndicators = !showNavigationIndicators" class="btn btn-outline-dark btn-sm">Toggle navigation indicators</button> | ||
</div> |
34 changes: 34 additions & 0 deletions
34
demo/src/app/components/carousel/demos/navigation/carousel-navigation.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {Component, OnInit} from '@angular/core'; | ||
import {NgbCarouselConfig} from '@ng-bootstrap/ng-bootstrap'; | ||
import {map} from 'rxjs/operators'; | ||
import {HttpClient} from '@angular/common/http'; | ||
|
||
@Component({ | ||
selector: 'ngbd-carousel-navigation', | ||
templateUrl: './carousel-navigation.html', | ||
providers: [NgbCarouselConfig] // add NgbCarouselConfig to the component providers | ||
}) | ||
export class NgbdCarouselNavigation implements OnInit { | ||
showNavigationArrows = false; | ||
showNavigationIndicators = false; | ||
images: Array<string>; | ||
|
||
constructor(config: NgbCarouselConfig, private _http: HttpClient) { | ||
// customize default values of carousels used by this component tree | ||
config.showNavigationArrows = true; | ||
config.showNavigationIndicators = true; | ||
} | ||
|
||
ngOnInit() { | ||
this._http.get('https://picsum.photos/list') | ||
.pipe(map((images: Array<{id: number}>) => this._randomImageUrls(images))) | ||
.subscribe(images => this.images = images); | ||
} | ||
|
||
private _randomImageUrls(images: Array<{id: number}>): Array<string> { | ||
return [1, 2].map(() => { | ||
const randomId = images[Math.floor(Math.random() * images.length)].id; | ||
return `https://picsum.photos/900/500?image=${randomId}`; | ||
}); | ||
} | ||
} |
1 change: 0 additions & 1 deletion
1
demo/src/app/components/timepicker/demos/adapter/timepicker-adapter.ts
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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