私のカスタム背景画像がAngularJSに表示されません。理由を理解できません。AngularJSに背景画像が表示されない
app.controller('backgroundImageCtrl', function($scope, $http) {
$scope.setBackground = {
'background-image' : 'url(image.jpg)'
};
})
は、HTML::
<script type = "text/ng-template" id="/page.html" ng-controller="backgroundImageCtrl" ng-style="setBackground">
<div>
...
</div>
</script>
テンプレートを使用するdivでsetBackgroundを使用する必要があります。 –
'background-image'が' template'タグの上にあるからです。それは内側の要素にあるべきです。 –
あなたの質問にお答えしますか? –