0

我尝试angular-carousel在我的应用程序中添加,但出现此错误

   Failed to instantiate module ngMaterial due to:
Error: [$injector:modulerr] http://errors.angularjs.org/1.5.8/$injector/modulerr?p0=n...)
    at Error (native)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js:6:412
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js:40:222
    at q (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js:7:355)
    at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js:39:319)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js:39:488
    at q (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js:7:355)
    at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js:39:319)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js:39:488
    at q (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js:7:355

ngMaterial仅在使用轮播添加我的应用程序后,我才收到此错误。我正在使用 angularjs 的最新稳定版本 1.5.8。这是我到目前为止尝试过的代码,

    <!DOCTYPE html>
    <html ng-app="DemoApp">
        <head>
            <meta charset="UTF-8">
            <title>angular-carousel demo</title>
            <meta name="viewport" content="width=620, user-scalable=no">
            <link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'>
            <link rel="stylesheet" type="text/css" href="css/angular-material.min.css">
            <link href='css/angular-carousel.min.css' rel='stylesheet' type='text/css'>

        </head>
        <body ng-controller="DemoCtrl">
            <style type="text/css">
            .selected
    {
        background-color: red;
    }
    .demo
    {
        height: 500px;
        width: 100%;
    }
    .carousel5
    {
      height: 500px !important;
        width: 100% !important;   
    }
            </style>
                    <div class="demo" >

                        <ul rn-carousel rn-carousel-index="carouselIndex6" rn-carousel-deep-watch rn-carousel-buffered class="carousel5">
                            <li><div style="height:500px;width:100%;background-color:blue;"></div></li>
                            <li><div style="height:500px;width:100%;background-color:cyan;"></div></li>
                            <li><div style="height:500px;width:100%;background-color:grey;"></div></li>
                             <li><div style="height:500px;width:100%;background-color:yellow;"></div></li>
                        </ul>
                    </div>
                </div>
            </div>
        </body>
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"></script>
        <script src="https://code.angularjs.org/1.5.8/angular-touch.js"></script>
        <script src="js/angular-carousel.min.js"></script>
<script src="js/angular-material.min.js"></script>
        <script>
            angular.module('DemoApp', [
                'ngMaterial','angular-carousel'
            ]).controller('DemoCtrl', function($scope) {});
        </script>
    </html>

我错了吗?有人可以帮帮我吗?

4

2 回答 2

1

首先包含所有依赖项

 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js"></script>
 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.js"></script>
 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-aria.js"></script>

比包含 Angular Material JS 文件

 <script src="https://gitcdn.link/repo/angular/bower-material/master/angular-material.js"></script>
于 2016-08-30T10:39:19.183 回答
0

看起来不包括 ngMaterial js 文件

于 2016-08-30T10:34:17.443 回答