[UPDATE] I work with angular 2 carousel which is here:
https://embed.plnkr.co/ScE0uqfd0ZvL6T9j1XjL/
I wanna add transition effect.
In carousel-example ts I added property
<carousel [interval]="NextPhotoInterval" [noWrap]="noLoopSlides" [noTransition]="noTrans">
noTrans property I declared inside carousel-example.ts as private noTrans:boolean = false;
noTransition is inside carousel component as
@Input() public noTransition:boolean;
(where noTrans is false by default which by documentation should enable transitions).
This didn't do anything and I cant see any transition. Does anyone know where I'm wrong?
Thanks!
In the end I implemented my generic carousel using bootstrap, so I will post how I did it, in order to help if someone wants to use it:
component.html:
<div id="carousel-generic" class="carousel slide" data-ride="carousel" *ngIf="newsData">
<ol class="carousel-indicators" [hidden]="newsData.length <=1">
<li data-target="#carousel-generic" *ngFor="let news of newsData; let i= index" attr.data-slide-to="{{i}}" [ngClass]="{active: isActive(news)}"></li>
</ol>
<div class="carousel-inner news-loading" role="listbox">
<div *ngFor="let news of newsData;" class="item" [ngClass]="{active: isActive(news)}">
<h4 class="center">{{news.Title}}</h4>
<img class="img-responsive" [src]="news.ImageUrl">
<div class="news">
<p><a target="_blank" href="{{news?.DetailsUrl}}">{{news.Text}}</a></p>
</div>
</div>
<a class="left carousel-control" href="#carousel-generic" role="button" data-slide="prev" [hidden]="!newsData.length">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-generic" role="button" data-slide="next" [hidden]="!newsData.length">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
component.ts:
@Component({
selector: 'my-component',
templateUrl: 'app/components/component.html'
})
export class NewsComponent implements OnInit{
private newsData: NewsDataModel[];
constructor(private _service: MyService) {}
private isActive(news:any){
return news === this._service.newsData[0];
}
ngOnInit() {
this.newsData = this._service.newsData;
}
}
*I did subscribe() in my service