Setting active slide on angular-ui-bootstrap carousel

前端 未结 4 1698
孤城傲影
孤城傲影 2021-02-16 00:15

I\'m using angular, bootstrap and a plugin called \"ui-bootstrap\" for angular to make a carousel.

I have a list of thumbnails and when clicking one a modal with the ima

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-16 00:27

    I was attempting to figure out how to set my first item in the Bootstrap Carousel: http://getbootstrap.com/javascript/#carousel

    To a class of "active" on page load, like this:

    And solved it by using the ngClass directive: https://docs.angularjs.org/api/ng/directive/ngClass

    To add an expression that determines whether the index is 0, and then sets the class to "active".

    Example:

    This renders on the page as:

提交回复
热议问题