0

I'm working on a project with Ember.js and Sails.js now i'm having an issue in my controller,

i want to run a computed query and use "AND" clause but i don't know how to do it, i tried to google it but had no luck

here is my controller

selectedDepartment: Ember.computed(function (){
  return this.get('store').query('service', {
    where : {
      department : this.get('department.id'),
      isPublic : true
      }
   })
})

It's getting me crazy i mean what is wrong here ?

Abdul-Elah JS
  • 685
  • 1
  • 16
  • 36
  • query return Promise and Computed property are not Promise aware. You can go through [igniter article](https://emberigniter.com/guide-promises-computed-properties/) to make it promise aware. – Ember Freak Jul 17 '17 at 09:18
  • Okay I'm kind of new to Ember .. what do you mean by [igniter article] ? – Abdul-Elah JS Jul 17 '17 at 09:19
  • I forgot to include the link. now I updated [link](https://emberigniter.com/guide-promises-computed-properties/) in the above comments. Instead of making computed property to promise aware, you can look for other alternative options. – Ember Freak Jul 17 '17 at 09:31
  • @kumkanillam store methods return PromiseObject/PromiseArray objects. – locks Jul 18 '17 at 18:56
  • @locks Now only I am seeing the difference here in api doc said `returns Promise promise` that's the PromiseProxy objects ...Is `Promise promise` === PromiseProxy objects ? In all of my answer, I used to say it returns `Promise` Hope I will change it one day – Ember Freak Jul 18 '17 at 19:05
  • @Haboosh What is the problem here? Could you explain what's the problem of your code? Is there no output? Do you see an error on your console? Is your query code returning the wrong data set? – Timm Jul 19 '17 at 07:05
  • @Timm it doesn't show any results like if the query isn't working at all but if i deleted either the first or second condition it works like charm, my question is how could i use the "AND" clause in such case :( – Abdul-Elah JS Jul 19 '17 at 13:13

0 Answers0