Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49171

Multiple modal from one template Error

$
0
0

@blow wrote:

hi i got big problem..
i wish multiple modal from 1 template with different images.
problem : same modal opens.
plz help me..

template
-modal.html
-index.html

js
-app.js

img
-0.jpg
-1.jpg
-2.jpg
.
.
.
-n.jpg


--app.js--

  //showImage function is repeated by the loop.
  $scope.showImage = function(index) {  //index = 0  ->  ++1
   $ionicModal.fromTemplateUrl('templates/modal.html', {
    	scope: $scope,
	animation: 'slide-in-up'
    }).then(function(modal) {
	$scope.modal.[index] =modal; //error
	$scope.modal.[index].show();  //error
	$scope.x=index;
    });
  }
  $scope.hideImage = function(){
    $scope.modal.hide();
  }

---modal.html--

<div class="modal divModel transparent">
  <ion-pane class="transparent padding">
    <i class="icon ion-ios-close close-modal" ng-click="hideImage()"></i>
	<img  class="imgModel" ng-src="/img/{{x}}.jpg" class="fullscreen-image"/>
  </ion-pane>

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49171

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>