martingust / aurelia-repeat-strategies Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
I'd like to use this on a modern project (Aurelia CLI/Webpack), but the readme instructions are still for jspm.
I tried installing via
yarn add github:martingust/aurelia-repeat-strategies
which technically worked, and registered it (as stated in the readme, but using PLATFORM.moduleName since I'm using Webpack) with
.plugin(PLATFORM.moduleName('martingust/aurelia-repeat-strategies'))
but when I run it I get:
webpack-dev-server.js:1 ./src/main.ts
Module not found: Error: Can't resolve 'martingust/aurelia-repeat-strategies' in ...
If I try removing martingust/
and use
.plugin(PLATFORM.moduleName('aurelia-repeat-strategies'))
then I get
Error: Unable to find module with ID: martingust/aurelia-repeat-strategies
at WebpackLoader.<anonymous> (aurelia-loader-webpack.js:197)
at step (aurelia-loader-webpack.js:41)
at Object.next (aurelia-loader-webpack.js:22)
at aurelia-loader-webpack.js:16
at new Promise (<anonymous>)
at push../node_modules/aurelia-loader-webpack/dist/native-modules/aurelia-loader-webpack.js.__awaiter (aurelia-loader-webpack.js:12)
at WebpackLoader.push../node_modules/aurelia-loader-webpack/dist/native-modules/aurelia-loader-webpack.js.WebpackLoader._import (aurelia-loader-webpack.js:162)
at WebpackLoader.<anonymous> (aurelia-loader-webpack.js:262)
at step (aurelia-loader-webpack.js:41)
at Object.next (aurelia-loader-webpack.js:22)
warn Running jspm globally, it is advisable to locally install jspm via npm inst
all jspm --save-dev.
Looking up github:martingust/aurelia-repeat-strategies
warn Error on lookup for github:martingust/aurelia-repeat-strategies, retrying (
1).
Error: fatal: unable to access 'martingust/aurelia-repeat-strategies.git/':
Received HTTP code 407 from proxy after CONNECT
warn Error on lookup for github:martingust/aurelia-repeat-strategies, retrying (
2).
Error: fatal: unable to access 'martingust/aurelia-repeat-strategies.git/':
Received HTTP code 407 from proxy after CONNECT
warn Error on lookup for github:martingust/aurelia-repeat-strategies, retrying (
3).
Error: fatal: unable to access 'martingust/aurelia-repeat-strategies.git/':
Received HTTP code 407 from proxy after CONNECT
warn Error on lookup for github:martingust/aurelia-repeat-strategies
Error: fatal: unable to access 'martingust/aurelia-repeat-strategies.git/':
Received HTTP code 407 from proxy after CONNECT
err Error looking up github:martingust/aurelia-repeat-strategies.
warn Installation changes not saved.
When using this plugin in aurelia-skeleton-typescript-webpack the build script produces the following error:
ERROR in ./~/aurelia-repeat-strategies/dist/commonjs/index.js Module not found: Error: Cannot resolve module 'aurelia-templating-resources/repeat-strategy-locator' in C:\Development\node_modules\aurelia-repeat- @ ./~/aurelia-repeat-strategies/dist/commonjs/index.js 8:55-118
ERROR in ./~/aurelia-repeat-strategies/dist/commonjs/iterable-repeat-strategy.js Module not found: Error: Cannot resolve module 'aurelia-templating-resources/repeat-utilities' in C:\Development\node_modules\aurelia-repeat-strateg @ ./~/aurelia-repeat-strategies/dist/commonjs/iterable-repeat-strategy.js 13:49-105
If we take your example view/viewmodel pair, and extend it just a tiny bit to allow a contrived example where we update the bound property, as below, the issue is simple to replicate.
viewmodel
export class App {
data = {
"foo": {
baz: true
},
"bar": {
baz: false
}
}
update(){
this.data = {
"foo": {
baz: false
},
"bar": {
baz: true
}
};
}
}
view
<template>
<div repeat.for="[key, value] of data | iterable">
${key} ${value.baz}
</div>
<button class="button" click.trigger="update()">update</button>
</template>
Here you can see a screenshot of the behavior after the button is pressed. Subsequent presses cause the same effect, with additional DOM fragments being appended, rather than replacing the original markup.
Similarly, setting the viewmodel property to undefined has no effect whatsoever (you would expect it to clear out the relevant section of DOM, but instead the DOM fragment remains in place).
Let me know if I can add any further information. I thought I'd start with a bug report, since I am not yet familiar with the internals of Aurelia.
I'd like to use your plugin, but unfortunately versions aren't tagged, so I can't get reproducible installs. Current version seems to work for me. Could you please release it?
Found via aurelia/templating-resources#41
Really hoping this works. I tried installing via jspm as described in the readme but I get the error "Repo jspm:martingust/aurelia-repeat-strategies not found.". I ended up installing like this instead
jspm install github:martingust/aurelia-repeat-strategies
data
Object {
06-23-2016: {
"20:30 -04:00": {
"itemkey": { attr1:val1, attr2:val2, etc }
},
"anothertime": {
"itemkey":{attr1:val1, etc},
etc
}
},
06-24-2016: etc,
06-25-2016: etc,
06-27-2016: etc,
07-01-2016: etc
}
view.jade
h2 Firebase Listing Actual
ul
li(repeat.for="[date,times] of listObj | iterable")
|${a} ${times} // this works, shows value for ${a} and [object Object] for ${times}
ul
li(repeat.for="[a,b] of times | iterable")
|${a} ${b} // fails, Reflect.ownKeys on non-object
view.ts
listObj=[];
attached(){
let ref = firebase.database().ref('events');
ref.on('value', events => {
this.listObj = events.val();
});
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.