some answer for stackoverflow
HTML
<div ng-app>
<div ng-controller="SomeCtrl">
<div class="candidate" ng-style="candidate.style">
{{candidate.name}}
</div>
<button ng-click="changeCandidate()">
change Style
</button>
</div>
</div>
CSS
.candidate {
display: block;
height: 100px;
width: 200px;
}
JavaScript
function SomeCtrl($scope) {
$scope.candidate = {
"style" : {
backgroundImage: "url(https://homepages.cae.wisc.edu/~ece533/images/arctichare.png)"
},
"name" : "My Name"
};
$scope.changeCandidate = function() {
$scope.candidate = {
"style" : {
backgroundImage: "url(https://homepages.cae.wisc.edu/~ece533/images/airplane.png)"
},
"name" : "Another Name"
};
};
};