1
の現在のの値を変更する必要がありますが、その後ng-src="{{array[current].src}}"
も変更する必要がありますが、機能していません。どんな助けもありがとう。ng-srcで角度jsの双方向結合
<div id="media-gallery" class="small reveal text-center media-gallery" data-reveal>
<div class="modal-body">
<div class="main-media">
<img ng-bind="current" class="main-gallery media-gallery-main" ng-src="{{array[current].src}}"/</div>
<hr>
<div class="nested-media">
<img ng-click="changeMainMedia($index)" ng-repeat="obj in array" class="thumbnail media-gallery-thumbnail" ng-src="{{obj.src}}" />
</div>
</div>
<button class="close-button" data-close aria-label="Close reveal" type="button">
<span aria-hidden="true">x</span>
</button>
</div>
</div>
<script>
var app = angular.module("mediaGallery", []);
app.controller("mediaGalleryCtrl", ['$scope', function(scope) {
var array = [];
for (var i = 1; i < 10; i++) {
array.push({
src: "gallery/image (" + i + ").jpg"
});
}
scope.array = array;
scope.current = 0;
scope.changeMainMedia = function(index) {
this.current = index;
}
}]);