mercredi 16 mai 2018

Ember cannot pass parameter into action

It constantly gives me value undefined no matter what value I put in value or if I change it to onclick="". I've literally tried every combination I could think of. I've even used a tags to see if that will save the value. I'm not sure at all how I'm supposed to go about getting this image url.

This is in ember and I have used the combination in other parts of my code but this is the ONLY part that will not work.

Template file

<div class="gif-display">
              
                  <img width="150px"  src=>
              
</div>

Controller class

selectGIF: function (num) {
  console.log("num", num)
  let newPost = this.store.createRecord('post', {
    email: this.get("session.currentUser.email"),
    body: `${gifs[num].images.original.url}`,
    timestamp: new Date().getTime(),
    image: true
  });
  gifs = ''
  newPost.save()
}

And YES I have tested to see if it even runs the function and it does and the images do show up so that's not the problem either.

My question is, is it possible to pass a parameter into this function. If not is there a work around? Should I use a helper function?

Thank you!




Aucun commentaire:

Enregistrer un commentaire