javascript - How do I pass a angularjs variable into html tag? -
in controller:
$scope.height = "height:100px;"; $scope.color = "red"
in html:
<div class="capsule" ng-style="{'height': height; 'background': color}"></div>
how can make work?
you have semi colon ';' in between style, ng-style expects object (comma separated). below code should work -
<div class="capsule" ng-style="{'height': height, 'background': color}"></div>
Comments
Post a Comment