'slider angular' Clicking on the small images return the corresponding large images

I used a slide show since site: http://www.sitepoint.com/creating-slide-show-plugin-angularjs/

Added small side images . I wonder how do I get when clicking on the small images return the corresponding large images .

Thumbnails added with this code : (place templateurl.html)

<ul class="minimage" ng-show="image.visible" >

  <a ng-click="returner()"> <img ng-repeat="image in images" ng-src="/sliderAngular/img/{{image.src}}" width="70" height="56"/> </a>

</ul>

This is my attempt , as it could to make it work ? (place app.js)

scope.currentIndex=0;

scope.returner=function(){
   scope.currentIndex= ;

};

I'm several days trying unsuccessfully to really need the help of someone who knows . If you need any more information you can ask me, I'm very limited in English and angular.

Actually, there are many things wrong with the code you initially shared, some of which are:

  • UL tag doesn't have LI items
  • ng-show="image.visible" is outside of the ng-repeat, so image will always be undefined
  • the ng-repeat was on the img tag, so there was going to be only 1 link with tons of pictures inside of it.

Code sample using $index (attribute available inside of ng-repeat directives):

<ul class="minimage" ng-show="images.length"> <!-- show if there are items  -->
    <li ng-repeat="image in images"><a ng-click="returner($index)"><img ng-src="/sliderAngular/img/{{image.src}}" width="70" height="56"/></a></li>
</ul>

And:

scope.currentIndex=-1;
scope.returner = function(index){
    scope.currentIndex = index;
};

I managed to leave it the way it wanted a few months ago , now remembered this question and returned to give a more complete answer for future readers.

Place this code below where you want to appear the slider

<div ng-app="myApp">
    <div ng-controller="MyCtrl">
        <div images="images" class="slider" id="mauseOnOut">
    <div  class="slide" ng-repeat="image in images" ng-show="image.visible"> 
        <a ng-href="{{image.url}}"><img ng-src="{{image.src}}" width="444" height="250"/>
        <p class="texto">{{image.texto}}</p>
        </a>
    </div>

    <ul class="minimagem" ng-show="images.length"> 
      <li ng-repeat="image in images"><a ng-click="returner($index)"><img ng-src="{{image.src}}" width="70" height="56"/></a></li>
    </ul>

    <div class="arrows">
        <a href="" ng-click="prev()" ><img  src="http://s5.postimg.org/orczpkx0z/left_arrow.png"/></a> <a href="" ng-click="next()"><img src="http://s5.postimg.org/qkfwdwi7n/right_arrow.png"/></a>
    </div>
</div>
    </div>
</div>

Place the code below into your app.js , controller or a specific page for directives.

myApp.directive('images', function factory($timeout) {
  var directiveDefinitionObject = {

    transclude: false,
    restrict: 'AE',
    multiElement: true,
    scope: {
        images: '='
    },

    link: function postLink(scope, iElement, iAttrs) { 
      scope.currentIndex=0;

    scope.returner = function(index){
    scope.currentIndex = index;
   };

        scope.next=function(){
            scope.currentIndex<scope.images.length-1?scope.currentIndex++:scope.currentIndex=0;
        };

        scope.prev=function(){
            scope.currentIndex>0?scope.currentIndex--:scope.currentIndex=scope.images.length-1;
        };

        scope.$watch('currentIndex',function(){
            scope.images. forEach(function(image){
                image.visible=false;
            });
            scope.images[scope.currentIndex].visible=true;
        });

        // Start: For Automatic slideshow

        var timer;

        var sliderFunc=function(){
            timer=$timeout(function(){

                scope.next();
                timer=$timeout(sliderFunc,3000);
            },3000);
        };

        sliderFunc();

        scope.$on('$destroy',function(){
            $timeout.cancel(timer);
        });

        var myDiv = document.getElementById('mauseOnOut');

        myDiv.onmouseover = function() { 
            $timeout.cancel(timer);
        };

        myDiv.onmouseout = function() { 
            timer=$timeout(sliderFunc,3000);
        };

         // End : For Automatic slideshow
   }
  };
  return directiveDefinitionObject;
});

Place the code below into your controller and edit as you wish:

$scope.images = [

  {
        src:'http://s5.postimg.org/b2wzny14n/img1.png',
        url:'',
        texto:'Trees and mountains a pleasant and peaceful environment to live .'
  },
  {
        src:'http://s5.postimg.org/vlrvt0f1z/img2.jpg',
        url:'',
        texto:'Yellow and pond landscape sky that inspires a reflection on the existence'
  },
  {
        src:'http://s5.postimg.org/wms4i4w1j/img3.jpg',
        url:'',
        texto:'Yellow and pond landscape sky that inspires a reflection on the existence '
  },
  {
        src:'http://s5.postimg.org/k0hplatkn/img4.png',
        url:'',
        texto:'The cold and snow prevents does not prevent good news for those seeking good '
  },
  {
        src:'http://s5.postimg.org/nitphougn/img5.png',
        url:'',
        texto:'Imposing Rhino with your muscles , bones and horns forming one of the strongest animals of nature '
  }
   ];

See the CSS and the slider operating in jsFiddle