Angular: Empty Fiddle
http://angularjs.org/
by Amir
HTML
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="MyCtrl">
<img ng-src="{{MyUtil.strConcat('http://localhost:8081/media/', path)}}" />
</div>
JavaScript
var myApp = angular.module('myApp',[]);
myApp.factory('MyUtil', function() {
return {
strConcat: function(str1, str2) {
return (angular.isDefined(str1) && angular.isDefined(str2)) ? (str1 + str2) : undefined;
}
}
});
function MyCtrl($scope, $timeout, MyUtil) {
$scope.MyUtil = MyUtil;
$timeout(function () {
$scope.path = 'images/23694c70-04d7-11e3-9ba8-73fb00de24c4.png';
}, 1000);
};