嗨朋友们,我是angularjs.i的初学者,如果从控制器那里向ng-style显示背景颜色
var app = angular.module("myApp", []).controller("myCtrl", function($scope) {
$scope.color = 'yellow';
$scope.zoom = 2;
});

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl" ng-style="{'background-color': color }">
</div>
&#13;
答案 0 :(得分:-1)
var app = angular.module("myApp", []).controller("myCtrl", function($scope) {
$scope.color = 'yellow';
$scope.zoom = 2;
});
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl" ng-style="{'background-color': color }">
welcome
</div>
&#13;