In this example of Ng-Src
, We have provided a button that will change the picture randomly. Here is the function to get the image src: $scope.changeImage
= function (index) { $scope.picIndex == 3 ? $scope.picIndex = 1 : $scope.picIndex += 1; $scope.picUrl = index == 1 ? "http://learnit.visrosoftware.com/datafiles/Nature-2.jpg" : (index == 2 ? "http://learnit.visrosoftware.com/datafiles/Nature-3.jpg" : "http://learnit.visrosoftware.com/datafiles/Nature-1.jpg"); };