-
Notifications
You must be signed in to change notification settings - Fork 652
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
Does it support keys with dot annotations? #262
Comments
Check out the examples page http://textalk.github.io/angular-schema-form/examples/bootstrap-example.html and switch to "complex keys" in the dropdown for an example on how to use it. Hope that helps. |
So, did I catch it clear - the keys with dot notation should be used in square brackets in the form JSON, and it only works with Angular 1.3.x? |
Oh sorry, i just reread you question. Dot notation is supported out of the box and is the standard way that ASF works, i was thrown off when you wrote complex keys as that is what we call when you use hyphens, brackets special chars etc. Dot notation only supports standard letters etc. Could you post your schema/form/model so we can see how you use it, it may just be a mismatch problem or you do actually need to use the bracket support, so yeah post it and we'll see. |
It's just a example piece of it but it should show the idea: {
} |
Ah yes, then you need complex keys, I'm not actually sure how it's used, maybe @davidlgj or @mike-marcacci can give further insight. |
Hi @lisss, yeah it's the complex keys you need, the basic trick is that whenever you have a .,- or any other character that wouldn't be valid JS code, you use a "bracket notation". So in your example that would be: {
"model": {},
"schema": {
"type": "object",
"properties": {
"kiuwan.agent": {"type": "string", "title": "Agent"}
}
},
"form": [{"key": "['kiuwan.agent']", "placeholder": "Some placeholder"}]
} The documentation on this is lacking though :) |
Yup, that's the way I supposed it to work but was unsure. (it still doesn't work in our project as we use Angular 1.2 but at least it's now more clear). Closing the issue, many thanks for responses. |
Hey all! Sorry for the delayed response. @lisss, because complex keys need to use bracket notation in the angular expressions: // invalid
model.foo-bar.baz
// valid
modal['foo-bar'].baz ...and Angular 1.2.x has serious problems using bracket notation, schema form sticks to dot notations in 1.2, making complex keys (unfortunately) impossible. Angular first fixed this in a 1.3-rc build, but didn't have anything for 1.2.x. I'm now curious if a patch has been applied to the 1.2 fork (which I believe is still alive for people who have lots of IE8 users). If it has, schema-form could use bracket notation everywhere, and your problem would magically be solved :) |
I use complex keys with dot annotations (e.g. "foo.bar") in JSON schema, and the form doesn't show the data from the model in such fields. Is it supported and how make it working then?
Thanks
The text was updated successfully, but these errors were encountered: