Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this.parent.one is not a function #2154

Closed
markgarrigan opened this issue Dec 12, 2016 · 3 comments
Closed

this.parent.one is not a function #2154

markgarrigan opened this issue Dec 12, 2016 · 3 comments
Labels

Comments

@markgarrigan
Copy link

@markgarrigan markgarrigan commented Dec 12, 2016

Help us to manage our issues by answering the following:

  1. Describe your issue:
    I'm looping through an array of objects. I do this all the time. However, currently I'm running into an issue where I receive an error in the console that says "this.parent.one is not a function". It seems to be caused when the object in the array has a key of "parent".

  2. Can you reproduce the issue?
    Yes

http://jsfiddle.net/markgarrigan/a4hza871/

  1. On which browser/OS does the issue appear?
    Chrome/OS X

  2. Which version of Riot does it affect?
    3.0.2

  3. How would you tag this issue?

  • Question
  • Bug
  • Discussion
  • Feature request
  • Tip
  • Enhancement
  • Performance
@GianlucaGuarini GianlucaGuarini added the bug label Dec 13, 2016
@markgarrigan
Copy link
Author

@markgarrigan markgarrigan commented Dec 13, 2016

#1713

I see there was already discussion about this. I understand renaming my key is a work around, however, when working with 3rd party api and JSON this doesn't seem like the best solution. For now, the renaming of the key is not a big deal. But, hopefully, there's a way to fix it in the core.

@rsbondi
Copy link
Contributor

@rsbondi rsbondi commented Dec 13, 2016

          <tr each={ item in bad_items }>
            <td>
              { item.description }
@markgarrigan
Copy link
Author

@markgarrigan markgarrigan commented Dec 16, 2016

Thanks @rsbondi! I see that does help. However, is that the fix or just another workaround? Seems like documentation may be needed?? Since it may be confusing for some people accessing the item in an event handler.

http://jsfiddle.net/markgarrigan/mbvmdww6/

<p each={ item in bad_items } onclick={ parent.remove }>{ item.description }</p>

remove(ev) {
  var item = ev.item.item
}

Maybe that's ok or just common sense? I'm not sure?

Regardless, thanks again for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.