ng-repeat-start和ng-repeat-end是angular(1.2.X)的擴展,用於靈活的控制遍歷ios
index部分:app
<div class="item item-input-inset" **ng-repeat-start**="item in accessoryImg"> <span class="input-label" ng-bind="i18n.accessory_label"></span> <!--附件--> <button class="button button-outline button-calm button-center" ng-bind="i18n.upload_accessory_btn" ng-click="accessory.click(item)"></button> <!--上傳附件--> </div> <!--圖片顯示區域--> <div ng-show="item.src" class="addImage border-none pos-relative padding" **ng-repeat-end** > <img ng-src="{{item.src}}" > <i ng-click="accessory.deleteAccessory(item)" class="icon ion-ios-close-outline pos-absolute font30 assertive deleteImg"></i> </div>
js部分spa
angular.module("app").controller("launchCtrl", ["$scope", function ($scope) { "use strict"; /*附件的內容*/ $scope.accessoryImg = [ { text: i18n.accessory_label, // 附件 src: "", type: "accessoryInfo" } ]; } ]);