aurelia / framework

The Aurelia 1 framework entry point, bringing together all the required sub-modules of Aurelia.
MIT License
11.76k stars 623 forks source link

Unable to send $parent to a valueConverter #791

Closed avrahamcool closed 7 years ago

avrahamcool commented 7 years ago

I'm submitting a bug report

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 commented 7 years ago

any news?

AshleyGrant commented 7 years ago

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

AshleyGrant commented 7 years ago

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 commented 7 years ago

@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 commented 7 years ago

Working on PR