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

ngRepeat #92

Open
zzau13 opened this issue Jan 5, 2016 · 7 comments
Open

ngRepeat #92

zzau13 opened this issue Jan 5, 2016 · 7 comments
Labels

Comments

@zzau13
Copy link

zzau13 commented Jan 5, 2016

Its possible use ngRepeat with this directive? Same that

<input type="checkbox" 
    ng-repeat="i in settSchema.typeLocal"
    local-forage="{key: 'settings', name: 'typeLocal.i', scopeKey: 'settings.typeLocal.i', defaultValue: false"
    ng-model="settings.typeLocal.i">

or need create a new key?

@ocombe
Copy link
Collaborator

ocombe commented Jan 5, 2016

hmm it should work, I haven't tried though

@zzau13
Copy link
Author

zzau13 commented Jan 5, 2016

For me yes, but the peevish nodejs dislikes, as it says Error: You must use the name of an existing instance.

@ocombe
Copy link
Collaborator

ocombe commented Jan 5, 2016

ok, one problem here is that name and key are strings, not scope values, so you're storing all your repeated data under the same name/key combination...

@zzau13
Copy link
Author

zzau13 commented Jan 5, 2016

Same

ng-repeat="i in settSchema.typeLocal" 
local-forage="{key: 'settings', name: typeLocal.i, scopeKey: settings.typeLocal.i, defaultValue: false}"
ng-model="settings.typeLocal.i" 
1     159109   error    Error: You must use the name of an existing instance

@zzau13
Copy link
Author

zzau13 commented Jan 7, 2016

Excuse me, you saw that I change the last comment?

@ocombe
Copy link
Collaborator

ocombe commented Jan 7, 2016

Sorry, the error has nothing to do with the ng repeat. It's because you're using the parameter "name", but you probably haven't config the provider to create an instance of that name: https://github.com/ocombe/angular-localForage#configure-the-provider-

The default instance name is "lf": https://github.com/ocombe/angular-localForage/blob/master/src/angular-localForage.js#L21

If you remove the parameter "name", it should work

@zzau13
Copy link
Author

zzau13 commented Jan 7, 2016

I've been testing and I've seen the ngRepeat instance variable that affects only scopeKey

ng-repeat="(key, data) in settings.kindLocal"
local-forage="{
key: kindLocal.key,

Like this return TypeError: model.assign is not a function in
https://github.com/ocombe/angular-localForage/blob/master/src/angular-localForage.js#L376

key: 'kindLocal.key',

Its at same key for all.

name: 'settings', 
scopeKey: 'settings.kindLocal[key]', 
defaultValue: data}"

Like this defaultValue is data, not variable data but string data. Needless to say, use 'data' its a same.
And use settings.kindLocal[key] its the first value of the loop.

ng-model="settings.kindLocal[key]">
{{ key }} {{ settings.kindLocal[key] }} === {{ data }}

Its seems to me ngRepeat not work with this directive.
It would be interesting to choose the storeName/table.
What do you think? And thanks for all.

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

No branches or pull requests

3 participants