Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amp-bind does not support splice with objects #11882

Closed
kul3r4 opened this issue Oct 31, 2017 · 3 comments
Closed

amp-bind does not support splice with objects #11882

kul3r4 opened this issue Oct 31, 2017 · 3 comments

Comments

@kul3r4
Copy link
Contributor

kul3r4 commented Oct 31, 2017

Documentation says that amp-bind support splice for arrays.
At the moment, it only supports splice with primitives, but not with objects, for example:

var newObj = [{id: 1, l: 2}, {id: 2, l:4}]
newObj.splice(0,0,{id: 3})
newObj

is not supported. I reproduced the problem here where I get:

amp-bind: Expression eval failed with error: Unexpected argument type in splice().​​​

So I tried just using a number instead of an object, and the errors goes away.
@choumx FYI

@ampprojectbot
Copy link
Member

This issue hasn't been updated in awhile. @choumx Do you have any updates?

1 similar comment
@ampprojectbot
Copy link
Member

This issue hasn't been updated in awhile. @choumx Do you have any updates?

@jackyjieliu
Copy link
Contributor

@kul3r4 @choumx I'm also running into this issue trying to add an object into an array in amp-state when the user performs action.
Wondering if there are any updates or if there is a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants