Closed 1hella closed 6 years ago
hi @1hella, I tried to reproduce this behavior but the bindings are working: https://github.com/code-chris/aurelia-knockout-binding
Which technology stack do you use?
Hi @code-chris. I'm using the default settings from the Aurelia command line tools (0.33.1), which is
Platform: Web Bundler: Webpack Loader: None Transpiler: Babel Markup Processor: Minimal Minification
I was able to reproduce it from the base generated project after adding a <div knockout>
around the <test>
element. That seems to be the key.
So from the base project, I was able to reproduce it with the following:
yarn add aurelia-knockout
main.js
...
aurelia.use
.standardConfiguration()
.feature(PLATFORM.moduleName('resources/index'))
.plugin(PLATFORM.moduleName('aurelia-knockout'));
...
app.js
export class App {}
app.html
<template>
<div knockout>
<test></test>
</div>
</template>
And the code from above.
@code-chris Ah okay that makes sense that it gets bound to the app view model instead of the custom element then. I didn't realize I couldn't just wrap everything in a knockout div.
Thanks for letting me know about the comments too.
It seems like any knockout bindings I try in a custom element won't work. Here's a simple example:
test.js
test.html
index.js
Then when I use the
<test></test>
element somewhere I get the errorWhat does work is changing
<test></test>
to<compose view-model="../../resources/elements/test"></compose>
, but is there any way to get knockout bindings to work without switching to compose?