title: How to set the opacity of an element?
body: <p>I have created some button elements using ng-repeat. Now I need to set opacity of those button elements based on the boolean value in JavaScript without ng-click because the opacity has to be set before any click events.</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;div id="splash_btn_box_ng"&gt;
      &lt;button id="{{button.buttonId}}" ng-click="setMode(button)" ng-repeat="button in buttons"&gt;&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I tried to set opacity in init() like the following,</p>
  
  <pre><code>$scope.buttons.buttonId.style.opacity = 0.3;
  </code></pre>
  
  <p>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(): </p>
  
  <blockquote>
    <p>TypeError: Cannot set property 'opacity' of undefined</p>
  </blockquote>