这是我正在尝试制作的广告(电子商店折扣代码)应用程序。
广告列在 Array 中,每个广告有 4 个内容(名称、图片链接、折扣 (%)、折扣代码)
这就是我列出广告的方式(使用 ng-repeat):
<div class="list">
<div class="item item-thumbnail-left" href="#" ng-repeat="item in dovanosListArray" >
<img ng-src={{item.image}}>
<h2>{{item.name}}</h2>
<button menu-toggle="right"class="button-icon icon ion-ios7-arrow-forward" ng-click="modal.show()"></button>
<p>Nuolaida : {{item.discount}} %</p>
</div>
</div>
因此,当您单击所需的那个时,模式就会打开。在模态中,我需要再次显示相同的 {{item.name}} 并给出它的 {{item.discountcode}} 。我该怎么做?我无法使用 ng-repeat,因为同一数组中还有其他项目。
最佳答案
抱歉我的英语不好,我认为你需要的是这样的:
var modalInstance = $modal.open({
templateUrl: 'Modal.html',
controller: 'ModalCtrl',
resolve: {
item: function () {
return item;
}
}
在你的 Controller 中:
angular.controller('ModalCtrl', ['$scope','item',
function($scope, item , ) {
$scope.item=tem;
..........................
}])
所以在你的 Controller 中你已经有了 item 的值;
关于javascript - 将相同的信息导入模态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27108958/