Javascript 引导映像旋转木马在角度模式下不工作

Javascript 引导映像旋转木马在角度模式下不工作,javascript,html,angular,twitter-bootstrap,carousel,Javascript,Html,Angular,Twitter Bootstrap,Carousel,转盘的第一个图像出现在我的页面中,但是按钮不起作用,图像也不移动。我尝试过使用不同类型的引导转盘,但没有用。我看到一些答案建议将jQuery和引导链接添加到顶部,所以我尝试了一下,但也没有成功 home.component.html <header> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="styleshe

转盘的第一个图像出现在我的页面中,但是按钮不起作用,图像也不移动。我尝试过使用不同类型的引导转盘,但没有用。我看到一些答案建议将jQuery和引导链接添加到顶部,所以我尝试了一下,但也没有成功

home.component.html

<header>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet">
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    


    <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
        <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>
        </ol>
        <div class="carousel-inner">
            <div class="carousel-item active">
                <img class="d-block w-100" src="https://placeimg.com/1080/500/animals" alt="First slide">
                <div class="carousel-caption d-none d-md-block">
                    <h5>My Caption Title (1st Image)</h5>
                    <p>The whole caption will only show up if the screen is at least medium size.</p>
                </div>
            </div>
            <div class="carousel-item">
                <img class="d-block w-100" src="https://placeimg.com/1080/500/arch" alt="Second slide">
            </div>
            <div class="carousel-item">
                <img class="d-block w-100" src="https://placeimg.com/1080/500/nature" alt="Third slide">
            </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>

</header>

  • 我的标题(第一幅图片) 只有当屏幕至少为中等大小时,才会显示整个标题

    index.html

    <!doctype html>
    <html lang="en">
    <head>
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
      <meta charset="utf-8">
      <title>CastleApp</title>
      <base href="/">
    
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="icon" type="image/x-icon" href="favicon.ico">
      <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet">
    </head>
    <body>
      <app-root></app-root>
    </body>
    </html>
    
    
    卡斯特里普
    
    引导需要JQuery来执行此类操作。您需要在index.html中添加jquery,或者将其添加到
    angular cli.json
    angular.json
    (取决于您的angular版本):

    方法1(建议): 首先运行此命令以安装JQuery和引导:

    $ npm install jquery bootstrap --save
    
    然后将这些行添加到
    angular cli.json
    angular.json
    (取决于您的angular版本)

    方法2(不建议): 在index.html中添加所需的脚本。不过要小心,因为每次重新加载页面时都会下载这些模板

    <!doctype html>
    <html lang="en">
    <head>
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
      <meta charset="utf-8">
      <title>CastleApp</title>
      <base href="/">
    
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link rel="icon" type="image/x-icon" href="favicon.ico">
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
    
    </head>
    <body>
      <app-root></app-root>
      <!-- Optional JavaScript -->
      <!-- jQuery first, then Popper.js, then Bootstrap JS -->
      <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
      <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
      <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
      
    </body>
    </html>
    
    
    卡斯特里普
    

    @Harish这里是正确的答案。这将解决您的问题,添加popover.js
    <!doctype html>
    <html lang="en">
    <head>
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
      <meta charset="utf-8">
      <title>CastleApp</title>
      <base href="/">
    
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link rel="icon" type="image/x-icon" href="favicon.ico">
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
    
    </head>
    <body>
      <app-root></app-root>
      <!-- Optional JavaScript -->
      <!-- jQuery first, then Popper.js, then Bootstrap JS -->
      <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
      <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
      <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
      
    </body>
    </html>