Framework: Unable to send $parent to a valueConverter

Created on 15 Jun 2017  路  5Comments  路  Source: aurelia/framework

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.

bug

Most helpful comment

Working on PR

All 5 comments

any news?

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

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>

@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.

Working on PR

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ConductedClever picture ConductedClever  路  5Comments

bsrdjan picture bsrdjan  路  5Comments

RichiCoder1 picture RichiCoder1  路  4Comments

piet-v picture piet-v  路  3Comments

tallesdantas picture tallesdantas  路  7Comments