I wanted to get a background image in my html page where the image is coming from a rest api. Below is my html code
<img class="background-img" id="container" ng-src="{{::backgroundImgUrl}}">
from my controller.js I'll be calling something like,
var idx = Math.floor(Math.random() * (4 - 1)) + 1;
$scope.backgroundImgUrl = "http://myrestsvc.mydomain.com/api/images/v3/" + idx;
My output should be like below,
<img class="background-img" id="container" ng-src="http://myrestsvc.mydomain.com/api/images/v3/5" src="http://myrestsvc.mydomain.com/api/images/v3/5">
This is the expected behavior and I'm not a java developer, how do I write a java rest api controller to achieve this?
I'm using Spring v1.3.3 and angularJS. Thanks in advance.