Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
option value as string not index using ng:options
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
007design  
View profile  
 More options Feb 12, 1:35 pm
From: 007design <007design....@gmail.com>
Date: Sun, 12 Feb 2012 10:35:44 -0800 (PST)
Local: Sun, Feb 12 2012 1:35 pm
Subject: option value as string not index using ng:options
i'm really liking angular for handling my UI, taking care of binding,
etc.  however, i'm having difficulty with the way it posts back to the
server.  my server side code is set up using a library that takes care
of binding request parameters to java beans (stripes).  unfortunately,
it doesn't work with JSON data in the body of the request.
so, what i'm doing is using angular to populate forms but then
submitting them using jQuery (and jQuery.serialize()).  the trouble is
that select controls populated using ng:options have option elements
like this:
<option value="0">myValue</option>
rather than this:
<option value="myValue">myValue</option>

is there a way that I can have the value attribute of the option tags
be a value string rather than an index?  i was hoping inputType would
help but that doesn't seem to work on select elements.

here's a fiddle demonstrating my issue:
http://jsfiddle.net/007design/tXgJx/

thanks very much!
007


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vojta Jina  
View profile  
 More options Feb 12, 6:25 pm
From: Vojta Jina <vojta.j...@gmail.com>
Date: Sun, 12 Feb 2012 15:25:42 -0800 (PST)
Local: Sun, Feb 12 2012 6:25 pm
Subject: Re: option value as string not index using ng:options

I guess you want something like this: http://jsfiddle.net/vojtajina/2JWb2/
http://docs-next.angularjs.org/api/angular.widget.select

You can define your own transform fn, to convert the data into url-encoded
format instead of json.
See Request / Response transformations
in http://docs-next.angularjs.org/api/angular.module.ng.$http

V.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
007design  
View profile  
 More options Feb 12, 7:49 pm
From: 007design <007design....@gmail.com>
Date: Sun, 12 Feb 2012 16:49:20 -0800 (PST)
Local: Sun, Feb 12 2012 7:49 pm
Subject: Re: option value as string not index using ng:options
Thanks for your response.  Unfortunately, mixing angular and
urlencoded requests is turning out to be much more difficult.  This
makes sense, of course, since it really seems designed for passing
data back in the request body, doing away with query params pretty
much altogether.  I'm now working on using GSON to convert the JSON
requests into objects instead of binding the form field values / query
params to beans.
I hope I'm not posting too often.  Nothing wrong with asking a lot of
questions, right?
Thanks again!
007

On Feb 12, 5:25 pm, Vojta Jina <vojta.j...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »