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

Choice field doesn't appear to work. #1075

Closed
ashleydavis opened this issue May 19, 2016 · 6 comments
Closed

Choice field doesn't appear to work. #1075

ashleydavis opened this issue May 19, 2016 · 6 comments

Comments

@ashleydavis
Copy link

I've been trying to get a choices field into my admin page, specifically in the creation view.

I've tried the example from the documentation:

 nga.field('country', 'choice')
      .choices([
        { value: 'FR', label: 'France' },
        { value: 'US', label: 'USA' },
      ]),           

It causes the following error when opening the create page:

angular.js:13550 TypeError: t.choices is not a function
at pre (http://localhost:3000/bower_components/ng-admin/build/ng-admin.min.js:15:2545)
at http://localhost:3000/bower_components/angular/angular.js:9688:44
at invokeLinkFn (http://localhost:3000/bower_components/angular/angular.js:9694:9)
at nodeLinkFn (http://localhost:3000/bower_components/angular/angular.js:9072:11)
at compositeLinkFn (http://localhost:3000/bower_components/angular/angular.js:8397:13)
at nodeLinkFn (http://localhost:3000/bower_components/angular/angular.js:9088:24)
at compositeLinkFn (http://localhost:3000/bower_components/angular/angular.js:8397:13)
at nodeLinkFn (http://localhost:3000/bower_components/angular/angular.js:9088:24)
at compositeLinkFn (http://localhost:3000/bower_components/angular/angular.js:8397:13)
at publicLinkFn (http://localhost:3000/bower_components/angular/angular.js:8277:30)

@sam2x
Copy link

sam2x commented May 19, 2016

Huh. Can you expose your whole entity definition ?

@ashleydavis
Copy link
Author

ashleydavis commented May 20, 2016

I've created a repo that demonstrates the problem. These most recent commit adds a choice field that causes the issue.

Clone this: https://github.com/Real-Serious-Games/admin-portal-template

Install dependencies:

  npm install
  cd Client
  bower install
  cd ..\

Run the server:

  cd src
  node server.js

Navigate to the customer creation screen:

http://localhost:3000/your-secret-key/#/customers/create

The following error should appear in your browser console:

angular.js:13550 TypeError: t.choices is not a function

Note that this issue only happens in the most recent commit. If you revert back to the prior commit and go to the customer creation screen there is no issue.

@ashleydavis
Copy link
Author

The code that defines the entities can be found in customize.js.

@dspasojevic
Copy link

This looks to be the same issue as #778. I don't think that the fix for that issue has been released as part of 0.9.x.

Did you find a solution to this issue on 0.9.1?

@jpetitcolas
Copy link
Contributor

Can you have a look on last master version and check if you can still reproduce the issue?

@Phocea
Copy link
Contributor

Phocea commented Nov 18, 2016

No feedback since @jpetitcolas last request, closing...
Please feel free to reopen if required

@Phocea Phocea closed this as completed Nov 18, 2016
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