# Set opacity of an element in Angular JS

I have created some button elements using ng-repeat . Now I need to set opacity of those button elements based on boolean value in javascipt without ng-click because the opacity has to be set before any click events.

HTML

<div id="splash_btn_box_ng">
<button id="{{button.buttonId}}" ng-click="setMode(button)"
ng-repeat="button in buttons">
</button>
</div>


Tried to set opacity in init() like the following,

\$scope.buttons.buttonId.style.opacity = 0.3;


and ended up with the following error which means i think button was not created at the time i try to set opacity. So i could not achieve this in init(). Any help would be much appreciated

TypeError: Cannot set property ‘opacity’ of undefined

Source: AngularJS