Skip to content

Error when there is a dash in field name #168

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

Closed
mohsen1 opened this issue Nov 17, 2014 · 6 comments
Closed

Error when there is a dash in field name #168

mohsen1 opened this issue Nov 17, 2014 · 6 comments

Comments

@mohsen1
Copy link

mohsen1 commented Nov 17, 2014

If my model has property with dash in it, I will get the following errors.

Error: [ngModel:nonassign] Expression 'model.X-Test' is non-assignable. Element: <input ng-show="form.key" type="{{form.type}}" step="any" sf-changed="form" placeholder="{{form.placeholder}}" class="form-control" ng-model-options="form.ngModelOptions" ng-model="model.X-Test" ng-disabled="form.readonly" schema-validate="form">
http://errors.angularjs.org/1.2.15/ngModel/nonassign?p0=model.X-Test&p1=%3C…t%22%20ng-disabled%3D%22form.readonly%22%20schema-validate%3D%22form%22%3E
    at http://0.0.0.0:9000/bower_components/angular/angular.js:78:12
    at new NgModelController (http://0.0.0.0:9000/bower_components/angular/angular.js:16922:28)
    at invoke (http://0.0.0.0:9000/bower_components/angular/angular.js:3805:17)
    at Object.instantiate (http://0.0.0.0:9000/bower_components/angular/angular.js:3816:23)
    at $get (http://0.0.0.0:9000/bower_components/angular/angular.js:6922:28)
    at http://0.0.0.0:9000/bower_components/angular/angular.js:6309:34
    at forEach (http://0.0.0.0:9000/bower_components/angular/angular.js:330:20)
    at nodeLinkFn (http://0.0.0.0:9000/bower_components/angular/angular.js:6296:11)
    at compositeLinkFn (http://0.0.0.0:9000/bower_components/angular/angular.js:5761:15)
    at nodeLinkFn (http://0.0.0.0:9000/bower_components/angular/angular.js:6344:24) 

From what I see, it's trying to access model.X-Test which is invalid JS. From my little research it could be related to $$value expression here

@mike-marcacci
Copy link
Contributor

Hey @mohsen1, there is a bug in Angular 1.2 that makes this impossible, but this works perfectly if you're on Angular 1.3

@mohsen1
Copy link
Author

mohsen1 commented Nov 17, 2014

Thanks @mike-marcacci Upgrading to 1.3 fixed this. I needed a good incentive to take the time and upgrade. This did it!

@mohsen1 mohsen1 closed this as completed Nov 17, 2014
@mike-marcacci
Copy link
Contributor

Awesome, glad it worked!

mohsen1 added a commit to swagger-api/swagger-editor that referenced this issue Nov 17, 2014
This upgrade was made with using a fork of angular-ui-layout at
https://github.com/mohsen1/ui-layout
TODO: remove dependecy to mohsen1.ui-layout when ui-layout is ready
End-to-end tests are failing after this upgrade due to an error in minified vendor.js
Main reason to upgrade was this bug:
json-schema-form/angular-schema-form#168
@ajit-drag
Copy link

Not working in form binding. I am using <select ... ng-model="staff.member-Type">. But still facing same issue. what could be the possible solution. As JSON format cant be changed.

@Anthropic
Copy link
Member

@ajit-drag you need to make a plunker or gist or provide exampes if you want people to understand your issue.

@margi212
Copy link

margi212 commented Nov 7, 2019

Same issue face @ajit-drag
Did you find nay Solution?

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

No branches or pull requests

5 participants