AngularJS Example:
HTML
<div ng-app="main">
<div ng-controller="ExampleController">
<h1>currentThumb</h1>
<img ng-src="{{currentThumb.data}}">
</div>
</div>
CSS
</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ -->
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js"></script>
<style>
JavaScript
var app = angular.module('main',[]);
app.factory('ImageService', function($http)
{
image = null;
return {
getImage: function($data)
{
image = $http.post('http://dopserv1.dop.com/test/auth.php', $data, {timeout:20000})
return image
}
}
});
function ExampleController($scope, ImageService)
{
$scope.currentThumb = ImageService.getImage({
'type' : 'thumb',
'index' : 1,
'location' : 'http://digitalout.vo.llnwd.net/o35/s/mobilevforum/test/'
});
}