Darex1991
Darex1991

Reputation: 877

FindBy in ember.js

I want find models from store. I try : In route:

MyApp.EventTalksRoute = Em.Route.extend
  model: ->
    MyApp.get('store').findBy('type', 'workshop')
    MyApp.store.findBy('type', 'workshop')
    Em.computed.findBy('type', 'workshop')

Also in controller:

MyApp.EventTalksController = Em.ObjectController.extend
  model: ->
    MyApp.computed.findBy('type', 'presentation')
    workshops: Em.computed.findBy('type', 'workshop')

And in view:

MyApp.EventTalksView = Ember.View.extend
  findBy: ['type', 'workshop']
  model: ->
    Ember.get('store').findBy('type', 'workshop')

But it's not working.. In console I have "findBy is not a function"?

Upvotes: 0

Views: 567

Answers (1)

Darex1991
Darex1991

Reputation: 877

First reason: I uses findBy.. I should used filterBy..

Second: I used content:

  MyApp.TalkGroupTabsView content=model.talkGroups

and then I must use

MyApp.TalkGroup = DS.Model.extend
  workshops: Em.computed.filterBy 'talksSorted', 'type', 'workshop'

Quest complete :)

Upvotes: 1

Related Questions