java

  • @Controller @RequestMapping(“/{name}”) public class HelloController { @RequestMapping(value = “/{name}”, method = RequestMethod.GET) public @ResponseBody String name(@PathVariable String name) { return this.name(name); } @RequestMapping(“/layout”) public String getHomePage(ModelMap modelMap) { return “hello/layout”; } }
  • You can simply extract name from URL when angularJS is loaded and bind it with name scope variable.
  • Stack Overflow works best with JavaScript enabled
  • i have made changes in the code, i forgot to add $window in controller function, my bad i have made changes in code.
  • I am trying to make simple page with Hello and name user using PathVariable.

I am trying to make simple page with Hello and name user using PathVariable. Well, if you come on http://localhost:8080/#/John you will see on site “Hello John”.

@springoverflow: Path Variable using AngularJS and Spring

when you are running this code, open console (google chrome’s) and tell what is the output? I mean i want to know the result of console.log() line. – Mohd Asim Suhail 10 hours ago

i have made changes in the code, i forgot to add $window in controller function, my bad i have made changes in code. Try now. – Mohd Asim Suhail 9 hours ago

java