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

Unable to send $parent to a valueConverter #791

Closed
avrahamcool opened this Issue Jun 15, 2017 · 5 comments

Comments

Projects
None yet
4 participants
@avrahamcool

avrahamcool commented Jun 15, 2017

I'm submitting a bug report

  • Library Version:
    1.1.2

  • Operating System:
    Windows 10

  • Node Version:
    6.10.2

  • NPM Version:
    5.0.3

  • Aurelia CLI OR JSPM OR Webpack AND Version
    CLI 0.30.0 (System.js + ESNext)

  • Browser:
    all

  • Language:
    ESNext

Current behavior:
passing $parent variable to a valueConverter throws an exception.
I'm able to access the $parent variable from a loop, and I'm also able to access his properties.

Expected/desired behavior:
I should be able to pass the $parent variable to a valueConverter as if it was a regular variable.

I also created a gist to demonstrate the problem.
(but i'm not sure what version of the framework is running in the gist)
https://gist.run/?id=86fc278d3837718be4691acd5625aaad
you need to uncomment the buggy line to show the error in the console.

@avrahamcool avrahamcool changed the title from Unable to send `$parent` to a `valueConverter` to Unable to send $parent to a valueConverter Jun 15, 2017

@EisenbergEffect EisenbergEffect added the bug label Jun 16, 2017

@avrahamcool

This comment has been minimized.

Show comment
Hide comment
@avrahamcool

avrahamcool commented Sep 1, 2017

any news?

@AshleyGrant

This comment has been minimized.

Show comment
Hide comment
@AshleyGrant

AshleyGrant Sep 5, 2017

Member

I'm betting this is a parser error, where the parser thinks it is beginning another ${ ... } block.

Member

AshleyGrant commented Sep 5, 2017

I'm betting this is a parser error, where the parser thinks it is beginning another ${ ... } block.

@AshleyGrant

This comment has been minimized.

Show comment
Hide comment
@AshleyGrant

AshleyGrant Sep 5, 2017

Member

In the meantime, here's a hack that can get around this: https://gist.run/?id=f5a165c276274f868256f0a849c55b8c

  <div repeat.for="i of arr">
    <div ref="temp" parent.bind="$parent"></div>
    $parent with conveter = ${ temp.parent | stringify}
  </div>
Member

AshleyGrant commented Sep 5, 2017

In the meantime, here's a hack that can get around this: https://gist.run/?id=f5a165c276274f868256f0a849c55b8c

  <div repeat.for="i of arr">
    <div ref="temp" parent.bind="$parent"></div>
    $parent with conveter = ${ temp.parent | stringify}
  </div>
@AshleyGrant

This comment has been minimized.

Show comment
Hide comment
@AshleyGrant

AshleyGrant Sep 5, 2017

Member

@jdanyow here's the line where things fail: https://github.com/aurelia/binding/blob/048c8dd217fffbf53276e9d65745d2fd10af6686/src/parser.js#L327

In parseAccessOrCallScope, I'm betting if we add a this.peek.text === '|' and this.peek.text === '&' to that if statement things will work.

Member

AshleyGrant commented Sep 5, 2017

@jdanyow here's the line where things fail: https://github.com/aurelia/binding/blob/048c8dd217fffbf53276e9d65745d2fd10af6686/src/parser.js#L327

In parseAccessOrCallScope, I'm betting if we add a this.peek.text === '|' and this.peek.text === '&' to that if statement things will work.

@AshleyGrant

This comment has been minimized.

Show comment
Hide comment
@AshleyGrant

AshleyGrant Sep 5, 2017

Member

Working on PR

Member

AshleyGrant commented Sep 5, 2017

Working on PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment