javascript - How to inject the Store to my ember component -


i in situation need inject store component , @ least think need.

this situation:

i have component , code not matter paste better understanding:

//components/masonry-plugin.js import ember '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();     });     } }); 

this own template

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

this template imported in other template photography.hbs {{masonry-plugin}}

the question is, since in photography.hbs have access module imglink, because in route photography.js create module consuming flickr api, how can make module accessible template in {{masonry-plugin}} ?

hope explanation clear

here model img clarification

var img = ds.model.extend({     imglink: ds.attr('string') }); 

first, don't need store in component.

just pass img model instance or imglink string component:

{{masonry-plugin model=model}}  

(this depends on having img available on calling context)

if not try provide simple example ember-twiddle or @ least code of photography route, controller , template.


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -