lundi 25 janvier 2016

Returning modules to a Specific Component Ember

I have a component in my app.

The component {{masonry-plugin}} is inside one of my templates called photography.hbs

this is the logic of the component

//components/masonry-plugin.js
import Ember from 'ember';

export default Ember.Component.extend({
  didInsertElement : function(){
    this._super();
    Ember.run.scheduleOnce('afterRender', this, this.afterRenderEvent);
  },

  afterRenderEvent : function(){
    var $grid = this.$('.grid').masonry({
      itemSelector: '.grid-item',
      percentPosition: true,
      columnWidth: '.grid-sizer'
    });
    // layout Isotope after each image loads
    $grid.imagesLoaded().progress( function() {
      $grid.masonry();
    });  
  }
});

The problem is that i do not know to pass the modules to my component template{{masonry-plugin}}

which is the following

<div class="grid">
    <div class="grid-sizer"></div>
    {{#each model}}
        <div class="grid-item">
          <img {{bind-attr src=imgLink}}>
        </div>
     {{/each}}
</div>

imgLink is the module record created in photography route consuming the flickr API.

How can i say to my component to return these models? Is there maybe an other better idea on how to do it? If i have static url the images src and components work, so i have to figure this problem out in order to get the img src model

I am using Ember 1.13.11




Aucun commentaire:

Enregistrer un commentaire