0

I want to use the angularJs Template value in spring Controller.

If it is like

ng-model=x

and we show the data with {{x}}

how can I use this x value in a Spring Rest Controller's method as a parameter?

6
  • You can send x as parameter to controller. Commented Jan 4, 2017 at 13:10
  • How ? there i am struggling Commented Jan 4, 2017 at 13:11
  • 1
    Try some research with @RequestParam, @PathVariable, @RequestBody etc ... Commented Jan 4, 2017 at 13:13
  • Thanks for the clue Commented Jan 4, 2017 at 13:30
  • @TheKojuEffect Solved it Commented Jan 13, 2017 at 14:06

1 Answer 1

1

I have solved the Issue .

Here is the Answer:

if in AngularJs( in the HTML templete) is {{x}}

then in spring RestController we can use with @RequestParam

Therefore ,

@RequestMapping(value = "/TheAddress",
    method = RequestMethod.POST,
    produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public TheName(@RequestBody String anystring,
                     @RequestParam("x") String asThevaliableToUseInTheControler) {

//The code
}
Sign up to request clarification or add additional context in comments.

1 Comment

plus one for posting for solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.