0
我想知道是否有可能將參數從html傳遞給css文件。是這樣的:將綁定參數傳遞給CSS
//css
.some-class [args]{
color: $(args.color|default:'#fff')
height: $(args.height|default:'50px')
}
//html
<body ng-app='App'>
<div ng-controlle="Ctrl">
<div ng-class='some-class${{element}}'></div>
</div>
</body>
//js
angular.module('App',[])
.controller('Ctrl',["$scope",function(){
$scope.$on('EchangeColor',function(newColor){
$scope.element.color = newColor
})
$scope.$on('EchangeHeight',function(newHeight){
$scope.element.height = newHeight
})
}])