{
"$id":"-KMVCUSAsz92c0Hp296i",
"$priority":null,
"aQuestion":"what is your favorite color",
"option1":{"option":"red","vote":1},
"option2":{"option":"blue","vote":2},
"option3":{"option":"green","vote":0},
"option4":{"option":"yellow","vote":0}
}
So using dot notation to access this object from Firebase, using vm.data.$id and vm.data.$priority returns the correct value. However using vm.data.aQuestion or vm.data.option1 yields undefined. I've looked at several posts, however none have fixed this issue for me. Is there something simple I'm not understanding?
Okay, I think I may have figured it out. I was luckily able to find this post shortly after reading Surjeet's about something making my field null or empty.
Cannot access Firebase object attributes. Value displayed as undefined ANGULARFIRE
Because Firebase values are loaded asynchronously, the value did not load. after using vm.data.$loaded().then was I able to retrieve through dot notation. Not sure if this is the best way, but it works. Thanks everyone for your help.
Also, if anyone that reads this has a better way to go about this issue, please let me know. Thanks!
Try to see have you did something in your code which is making your object field null.
If not then,
Try this one vm.data['aQuestion']
Related
How to correct this error and make the code work, the problem with the data filter in redux? I reviewed a lot of material on this topic, but did not find a solution to get the code to work, I would be very grateful for the help. Understanding that the problem may be in reducers, but I could not clearly understand how to correct the error. The key point is to display a list of customers on the left, enter with a filter and click on the user with detailed information on the right.
Here is my example code more detailed -> https://codesandbox.io/s/sweet-rgb-7nl0h
I saw your code, your problem is not with filter. The error says that it Cannot read property 'filter' of undefined, it means that state.allPeople is undefined. I checked out your reducers and noticed you have no reducers! Write a reducer for allPeople and then you'll be ok!
here's a working demo https://codesandbox.io/s/youthful-resonance-i71ey.
I just added -:
testStore: state.allPeople && state.allPeople.filter(user => isMatch(user, state.filterPeople)) || []
in index.js line no. 122.
Also your allUsers and filterUsers files are empty.
It will work once we add proper reducer into it.
Trying to do something which is very simple but am getting strange results.
I have an image stored as an attachment which I want to display in a VF Page.
If I do this it works fine
<apex:image url="{!URLFOR($Action.Attachment.Download,'00PR0000008Q3YmMAK')}"/>
However that was for testing purposes that I hardcoded the id. If I try reference the Id in the object then it fails. Even though the value contained in the object is exactly the same as above.
<apex:image url="{!URLFOR($Action.Attachment.Download,model.PreviewImageAttachId)}"/>
When I load the page I get an error in URLFOR param!!!
I thought my problem was because model.PreviewImageAttachId was a String and not an Id so I created a wrapper to return it as an Id - same error.
I then decided Salesforce must have some strange requirement that you can only pass in the REAL object so I did that and passed in model.Attach.Id and it still fails!!
Please can someone explain this to me and more importantly suggest a solution??!?
Once again if I output to the page
{!model.PreviewImageAttachId} i get 00PR0000008Q3YmMAK
So I just cant explain this!
Thanks!
My bad...
Was using apex:repeat and turns out SOME of the id values were null.
Hence the error
I have a question about React Syntax.
I was conceptualising a rebuild of my website in React and was writing code to access the data-attribute value.
The method I used to get the data-attribute value was:
e.target.getAttribute('data-menuItem');
and that seemed to work just fine. Upon further investigation I read about the alternative notation for the same method looks like:
e.target.attributes.getNamedItem('data-menuItem').value
I would just like to know if the second method I mentioned is best practice or if it really matters at all.
Your help is much appreciated.
Thanks
Moe
Let suppose that you have <div data-pg="abc"></div> in your html then in react you can retrieve data attributes:
let val = e.target.dataset.pg
Now your val will have abc.
To retrieve value of data attribute, alternative way is:
let val = e.target.getAttribute('data-pg')
There is no real difference (DOM-wise) between getAttribute and attributes.getNamedItem - both exists in all modern browsers and you can use any of them.
The attributes property returns a live collection of all attribute nodes registered to the specified node, while the getAttribute function gives you direct access to the value of the attribute you wanted.
please explain me in a words why it works perfect when I call
ons.slidingMenu.toggleMenu()
having at the same time myMenu as variable of
<ons-sliding-menu ....var="myMenu">
I mean I should call myMenu.toggleMenu(), not ons.slidingMenu.toggleMenu() ....
I think that ons.slidingMenu is defined deep inside onsen. Where I could read about all this hidden vars? (I've found nothing about it in onsen-ui site)
Thanks!
It's the same object, but I would advice using the one you get using the var="..." attribute.
Actually if you have a navigator you get an ons.navigator variable as well. If you have many of the same type of component it will refer to the one that was parsed most recently.
I downloaded the Backbone.Paginator production version. I went through the example, copied and pasted everything exactly the way it appears, but I keep getting cannot read property 'requestPager'. What am I doing wrong? I already made the reference to the backbone.paginator.min.js, what else do I need to do?
Thanks
EDIT:
If I remove paginator, my application works fine. It displays data without any issue.
The problem was that I had referenced backbone.paginator after my collections. It's small things like these that I still have to get used to and be aware of.