0

尝试添加引导轮播 ui 时出现以下问题,我无法看到我在 js 上调用的图像

进口

 <!-- <link href="resource/bootstrap-3.3.6-dist/css/bootstrap.min.css" rel="stylesheet"> -->
<link href="//netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link href="resource/css/estilos.css" rel="stylesheet" >
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">

<script type='text/javascript' src='./resource/angular-1.5.5/angular.js'></script>
<script type='text/javascript' src='./app/controllers/Gallery2.js'></script>
<script type='text/javascript' src='./resource/framework/ui-bootstrap-tpls-2.0.2.js'></script>
<script type='text/javascript' src='./resource/angular-1.5.5/angular-animate.js'></script>

html

            <div class="span10" >
            <!--Body content-->
            <div ng-controller="CarouselDemoCtrl">
                <div style="height: 305px">
                    <div uib-carousel active="active" interval="myInterval" no-wrap="noWrapSlides">
                        <div uib-slide ng-repeat="slide in slides track by slide.id" index="slide.id">
                            <img ng-src="{{slide.Path}}" style="margin:auto;">
                            <div class="carousel-caption">
                                <h4>Slide {{slide.ImageID}}</h4>
                                <p>{{slide.Title}}</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

js

angular.module('myModule', ['ngAnimate', 'ui.bootstrap']).controller('CarouselDemoCtrl',function ($scope) {
    $scope.myInterval = 5000;
    $scope.slides = [[
        {
            "ImageID": 1,
            "Title": "Tulips",
            "Summary": "This is summary of Tulips",
            "Path": "\\resource\\img\\logo.png"
        }
    ]];

});

我还出现了这个 active、interval、wrap、index 的属性:

不允许使用属性索引

感谢您的帮助

4

1 回答 1

0

您正在按 中的属性进行跟踪id<div uib-slide ng-repeat="slide in slides track by slide.id" index="slide.id">项目$scope.slides没有该属性。您可以通过 ImageId 跟踪或将其更改为 id。我根据您的示例为您提供了一个工作 jsFiddle 的链接。

http://jsfiddle.net/gbsmit03/6c7z3fxk/

于 2016-08-18T17:49:43.410 回答