Closed pkozul closed 5 years ago
I think Codesandbox has some issues with dependencies, as you can see from this example: https://codesandbox.io/s/httpsgithubcomaureliatemplating-resourcesissues388-ftszo
It comes with latest version of templating-resources
, and is working fine.
Can you make sure your project has latest version of this module and try again?
As you said, it does now work in Codesandbox, but I cannot get it to work on my machine. I have created a brand new Aurelia project using the latest aurelia-cli
and then updated to the latest version of this module:
npm install aurelia-templating-resources@latest
It does not work though. The matcher never gets called. Is there another Aurelia library that also needs to be updated for this to work? Can you try creating a new Aurelia project to see if you get the same behaviour?
Thanks.
@pkozul Sorry for the false information. Can you try the following in your app entry (probably main.ts
):
import {Repeat} from 'aurelia-templating-resources';
Repeat.useInnerMatcher = false;
The reason is without static field useInnerMatcher
, it would have been a breaking changes. So we made it an opt-in fix.
@bigopon Yes, that did the trick! Now works. Thank you.
I see it's documented in the Aurelia docs, but I would never have found it myself :-)
https://aurelia.io/docs/api/templating-resources/class/Repeat/property/useInnerMatcher/
I'm submitting a bug report
Please tell us about your environment:
Operating System: Windows 10
Node Version: 10.16.0
NPM Version: 3.8.9
JSPM OR Webpack AND Version webpack 4.39.3
Browser: Chrome
Language: TypeScript 3.6.2
Current behavior: The matcher does not work inside of
repeat.for
when using checkboxes and arrays of objects.The example below (from the Aurelia docs) does work, as the matcher gets called, but it doesn't use
repeat.for
.https://aurelia.io/docs/binding/checkboxes#array-of-objects-with-matcher
If you remove the three checkboxes in the example above, and replace them with a
repeat.for
, the matcher no longer gets called.Expected/desired behavior: Demo: https://codesandbox.io/s/objects-s7lec?fontsize=14&module=%2Fsrc%2Fapp.ts
The call to
console.log()
in the above demo shows that the matcher never gets called. Also,ticking the checkboxes results in duplicates being added to the selected list.