Simple angular question driving me nuts

Associate
Joined
10 Jan 2006
Posts
483
I have a simple problem but cant seem to work out how to do it. Basically when a user clicks on a photo i want them to be able to select that photo. I have got the object back but I am not sure how to access it in the view without having to push to an array an ng repeat over it which cant be the best way to do it.

At the moment photo.flickr gives me the object back but I cant work out how to save to self.photo and then access the value in the view

Code:
function FlickrController($http){
  var self = this 
  self.photo = null
  self.all = []
  self.images = []

 self.showPhoto = function(photo){
    self.photo = photo.flickr
    console.log(self.photo)
   }
 }
 
Associate
OP
Joined
10 Jan 2006
Posts
483
Code:
<div ng-app='flickrApp' ng-controller='FlickrController as flickr'>

{{flickr.photo}}
</div>

I am using the constroller as syntax but when I do this it does not show up?
 
Back
Top Bottom