Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I am trying to switch from a pure JavaScript implementation to using AngularJS. I am unable to figure how to use the model attribute with the form that is now using AngularJS.

Controller

@ModelAttribute("frequencies")
public Frequency[] frequencies() {
    return Frequency.values();
}

@ModelAttribute("genders")
public Gender[] personGender() {
    return Gender.values();
}

@RequestMapping(value="uform", method=RequestMethod.GET)
public String loadUFormPage(Model m) {
    return "userManagment";
}

The initial JSP displayed all the Enums as:

  <form:select path="gender" id="genderOptions">
    <form:option value="">Select Gender</form:option>
    <c:forEach items="${genders}" var="gender">
      <form:option value="${gender}">${gender}</form:option>
    </c:forEach>>
  </form:select>

I am looking for an AngularJS equivalent of this JSP code since in AngularJS all data is passed as JSON.

share|improve this question
    
shouldn't it be Java rather than Javascript ? It's confusing, spring and javascript – Mritunjay 16 hours ago
    
There is a front end page that is in javascript that the end user can see. Does that answer your question? – Praveen 16 hours ago
    
you have just given Java code, I think you should provide the javascript code, and HTML as well – Mritunjay 15 hours ago
    
updated the question – Praveen 15 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.