findAll with a property defined by parentReturning a Promise from a Computed Propertycomputed property based on children within a collection of parentsHow to update child records in the store when parent record is saved?Is it possible to bind a parent component’s property, via template, to a child component computed property?Ember computed dynamic property pathEmber - child component updating a property coming from query params via parent componentCan an Ember component inherit parent component properties without passing in the template?Ember 2.11, Data passed between parent to child components.Angular 4 How to update parent component after delete an item in child componentEmber data changes in parent component not refelecting on UIangular sub components update a list in the parent component
Alternative to sending password over mail?
Western buddy movie with a supernatural twist where a woman turns into an eagle at the end
What's the point of deactivating Num Lock on login screens?
Emailing HOD to enhance faculty application
Intersection of two sorted vectors in C++
How do I write bicross product symbols in latex?
If human space travel is limited by the G force vulnerability, is there a way to counter G forces?
Has there ever been an airliner design involving reducing generator load by installing solar panels?
What is going on with Captain Marvel's blood colour?
How can saying a song's name be a copyright violation?
Why doesn't H₄O²⁺ exist?
Is it possible to create light that imparts a greater proportion of its energy as momentum rather than heat?
I'm flying to France today and my passport expires in less than 2 months
Forgetting the musical notes while performing in concert
Is there a hemisphere-neutral way of specifying a season?
Could gravitational lensing be used to protect a spaceship from a laser?
Can a rocket refuel on Mars from water?
Can a virus destroy the BIOS of a modern computer?
What does it mean to describe someone as a butt steak?
Doing something right before you need it - expression for this?
Would Slavery Reparations be considered Bills of Attainder and hence Illegal?
Infinite Abelian subgroup of infinite non Abelian group example
Can I ask the recruiters in my resume to put the reason why I am rejected?
What reasons are there for a Capitalist to oppose a 100% inheritance tax?
findAll with a property defined by parent
Returning a Promise from a Computed Propertycomputed property based on children within a collection of parentsHow to update child records in the store when parent record is saved?Is it possible to bind a parent component’s property, via template, to a child component computed property?Ember computed dynamic property pathEmber - child component updating a property coming from query params via parent componentCan an Ember component inherit parent component properties without passing in the template?Ember 2.11, Data passed between parent to child components.Angular 4 How to update parent component after delete an item in child componentEmber data changes in parent component not refelecting on UIangular sub components update a list in the parent component
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
2 components, 1 parent 1 child. The parent is a list with buttons. User clicks the button and the child editor becomes visible and the variable listType gets passed to the child from the parent.
I want a property to do a findAll in the child based on the listType property, e.g.
listType:null,
records: this.get('store').findAll(this.get('listType'));
problem is when the child editor first inits listType is undefined and takes a moment for the data to be passed down from the parent. How should I compute the records based on the listType so that it can dynamically change records when a different listType is selected from the parent list and not crash when the listType property is undefined on init?
This might seem a little weird but I have 20 different listTypes and being able to compute records this way will save me from having to create an additional 40 files to save and delete the model types required.
ember.js dynamic parent record findall
add a comment |
2 components, 1 parent 1 child. The parent is a list with buttons. User clicks the button and the child editor becomes visible and the variable listType gets passed to the child from the parent.
I want a property to do a findAll in the child based on the listType property, e.g.
listType:null,
records: this.get('store').findAll(this.get('listType'));
problem is when the child editor first inits listType is undefined and takes a moment for the data to be passed down from the parent. How should I compute the records based on the listType so that it can dynamically change records when a different listType is selected from the parent list and not crash when the listType property is undefined on init?
This might seem a little weird but I have 20 different listTypes and being able to compute records this way will save me from having to create an additional 40 files to save and delete the model types required.
ember.js dynamic parent record findall
add a comment |
2 components, 1 parent 1 child. The parent is a list with buttons. User clicks the button and the child editor becomes visible and the variable listType gets passed to the child from the parent.
I want a property to do a findAll in the child based on the listType property, e.g.
listType:null,
records: this.get('store').findAll(this.get('listType'));
problem is when the child editor first inits listType is undefined and takes a moment for the data to be passed down from the parent. How should I compute the records based on the listType so that it can dynamically change records when a different listType is selected from the parent list and not crash when the listType property is undefined on init?
This might seem a little weird but I have 20 different listTypes and being able to compute records this way will save me from having to create an additional 40 files to save and delete the model types required.
ember.js dynamic parent record findall
2 components, 1 parent 1 child. The parent is a list with buttons. User clicks the button and the child editor becomes visible and the variable listType gets passed to the child from the parent.
I want a property to do a findAll in the child based on the listType property, e.g.
listType:null,
records: this.get('store').findAll(this.get('listType'));
problem is when the child editor first inits listType is undefined and takes a moment for the data to be passed down from the parent. How should I compute the records based on the listType so that it can dynamically change records when a different listType is selected from the parent list and not crash when the listType property is undefined on init?
This might seem a little weird but I have 20 different listTypes and being able to compute records this way will save me from having to create an additional 40 files to save and delete the model types required.
ember.js dynamic parent record findall
ember.js dynamic parent record findall
edited Mar 8 at 23:55
Mike R
asked Mar 8 at 23:49
Mike RMike R
84
84
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
It looks like you need a computed property in your child component which is able to react to a missing listType.
import Component from '@ember/component';
import computed from '@ember/object';
import inject as service from '@ember/service';
export default Component.extend(
store: service(),
listType: null,
records: computed('listType', function ()
if (!this.listType)
return null;
return this.store.findAll(this.listType);
),
);
records
is going to return a promise and you will have to handle it this way in your template. I personally use this method https://stackoverflow.com/a/40180704/796999.
Another option could be passing records
into the child component instead of looking them up there. You would create the computer property the same way and just change your parent template to have child-component records=records
.
Ok got the computed property to work. Issue now is the child component hbs does not recompute and display data in the DOM.does not iterate in the child
– Mike R
Mar 11 at 15:34
I just added some information on rendering a promise, let me know if that helps.
– jrjohnson
Mar 11 at 16:04
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072556%2ffindall-with-a-property-defined-by-parent%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It looks like you need a computed property in your child component which is able to react to a missing listType.
import Component from '@ember/component';
import computed from '@ember/object';
import inject as service from '@ember/service';
export default Component.extend(
store: service(),
listType: null,
records: computed('listType', function ()
if (!this.listType)
return null;
return this.store.findAll(this.listType);
),
);
records
is going to return a promise and you will have to handle it this way in your template. I personally use this method https://stackoverflow.com/a/40180704/796999.
Another option could be passing records
into the child component instead of looking them up there. You would create the computer property the same way and just change your parent template to have child-component records=records
.
Ok got the computed property to work. Issue now is the child component hbs does not recompute and display data in the DOM.does not iterate in the child
– Mike R
Mar 11 at 15:34
I just added some information on rendering a promise, let me know if that helps.
– jrjohnson
Mar 11 at 16:04
add a comment |
It looks like you need a computed property in your child component which is able to react to a missing listType.
import Component from '@ember/component';
import computed from '@ember/object';
import inject as service from '@ember/service';
export default Component.extend(
store: service(),
listType: null,
records: computed('listType', function ()
if (!this.listType)
return null;
return this.store.findAll(this.listType);
),
);
records
is going to return a promise and you will have to handle it this way in your template. I personally use this method https://stackoverflow.com/a/40180704/796999.
Another option could be passing records
into the child component instead of looking them up there. You would create the computer property the same way and just change your parent template to have child-component records=records
.
Ok got the computed property to work. Issue now is the child component hbs does not recompute and display data in the DOM.does not iterate in the child
– Mike R
Mar 11 at 15:34
I just added some information on rendering a promise, let me know if that helps.
– jrjohnson
Mar 11 at 16:04
add a comment |
It looks like you need a computed property in your child component which is able to react to a missing listType.
import Component from '@ember/component';
import computed from '@ember/object';
import inject as service from '@ember/service';
export default Component.extend(
store: service(),
listType: null,
records: computed('listType', function ()
if (!this.listType)
return null;
return this.store.findAll(this.listType);
),
);
records
is going to return a promise and you will have to handle it this way in your template. I personally use this method https://stackoverflow.com/a/40180704/796999.
Another option could be passing records
into the child component instead of looking them up there. You would create the computer property the same way and just change your parent template to have child-component records=records
.
It looks like you need a computed property in your child component which is able to react to a missing listType.
import Component from '@ember/component';
import computed from '@ember/object';
import inject as service from '@ember/service';
export default Component.extend(
store: service(),
listType: null,
records: computed('listType', function ()
if (!this.listType)
return null;
return this.store.findAll(this.listType);
),
);
records
is going to return a promise and you will have to handle it this way in your template. I personally use this method https://stackoverflow.com/a/40180704/796999.
Another option could be passing records
into the child component instead of looking them up there. You would create the computer property the same way and just change your parent template to have child-component records=records
.
edited Mar 11 at 16:03
answered Mar 9 at 16:46
jrjohnsonjrjohnson
895818
895818
Ok got the computed property to work. Issue now is the child component hbs does not recompute and display data in the DOM.does not iterate in the child
– Mike R
Mar 11 at 15:34
I just added some information on rendering a promise, let me know if that helps.
– jrjohnson
Mar 11 at 16:04
add a comment |
Ok got the computed property to work. Issue now is the child component hbs does not recompute and display data in the DOM.does not iterate in the child
– Mike R
Mar 11 at 15:34
I just added some information on rendering a promise, let me know if that helps.
– jrjohnson
Mar 11 at 16:04
Ok got the computed property to work. Issue now is the child component hbs does not recompute and display data in the DOM.
does not iterate in the child– Mike R
Mar 11 at 15:34
Ok got the computed property to work. Issue now is the child component hbs does not recompute and display data in the DOM.
does not iterate in the child– Mike R
Mar 11 at 15:34
I just added some information on rendering a promise, let me know if that helps.
– jrjohnson
Mar 11 at 16:04
I just added some information on rendering a promise, let me know if that helps.
– jrjohnson
Mar 11 at 16:04
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072556%2ffindall-with-a-property-defined-by-parent%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown