I’ve used the Bootstrap carousel in Angular. When I move from one component to another, the carousel auto-sliding stops working until the page is refreshed and the next and preview buttons are selected. To be taken I also have Bootstrap 4 lib and jquery installed.

Any solution?

Enter image description here.

<div id="carouselExampleIndicators" class="carousel slide carousel-fade" data-ride="carousel" data-interval="5000">
            <ol class="carousel-indicators">
                <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
                <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
                <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
                <li data-target="#carouselExampleIndicators" data-slide-to="3"></li>
               
            </ol>
            <div class="carousel-inner" *ngIf="allbanners.length > 0">
    <!--first slider-->
                <div class="carousel-item active banner-box banner-product">
                    <a href="{{allbanners[0].bannerLink}}">
                        <img src="{{IMAGE_BASE_URL}}{{allbanners[0].image}}" class="img-fluid">
                        <div class="carousel-text">
                            <h5>{{allbanners[0].title}}</h5>
                            <p>{{allbanners[0].subTitle}}
                            </p>
                        </div>
                    </a>
                </div>
     <!--second slider-->
                <div class="carousel-item banner-box banner-product">
                    <a href="{{allbanners[1].bannerLink}}">
                        <img src="{{IMAGE_BASE_URL}}{{allbanners[1].image}}" class="img-fluid">
                        <div class="carousel-text">
                            <h5>{{allbanners[1].title}}</h5>
                            <p>{{allbanners[1].subTitle}}
                            </p>
                        </div>
                    </a>
                </div>
 <!--third slider-->
                <div class="carousel-item banner-box banner-product">
                    <a href="{{allbanners[2].bannerLink}}">
                        <img src="{{IMAGE_BASE_URL}}{{allbanners[2].image}}" class="img-fluid">
                        <div class="carousel-text">
                            <h5>{{allbanners[2].title}}</h5>
                            <p>{{allbanners[2].subTitle}}
                            </p>
                        </div>
                    </a>
                </div>
 <!--four slider-->
                <div class="carousel-item banner-box banner-product">
                    <a href="{{allbanners[3].bannerLink}}">
                        <img src="{{IMAGE_BASE_URL}}{{allbanners[3].image}}" class="img-fluid">
                        <div class="carousel-text">
                            <h5>{{allbanners[3].title}}</h5>
                            <p>{{allbanners[3].subTitle}}
                            </p>
                        </div>
                    </a>
                </div>
               
               
            </div>
            <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
                <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                <span class="sr-only">Previous</span>
            </a>
            <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
                <span class="carousel-control-next-icon" aria-hidden="true"></span>
                <span class="sr-only">Next</span>
            </a>
        </div>