Sandeep Singh Sandeep Singh - 1 year ago 70
AngularJS Question

How to access JSP variables inside the angular js constants

i have a module with the constants


When i'm using this url constant, it is showing as a string('
), but actually it should call the MyBean.getUrl method.

any suggestions?

Answer Source

If you access variables in JSP file, you can modify like code below



But If code is placed outside JSP file, you can use global variable to access variables.

you can type code below (in a JSP file)

url = '<%=MyBean.getUrl("uri-prefix")%>'

then you can access (in other javascript files)