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

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -