AngularJS Material design - md-colors on button hover

前端 未结 1 1470
执念已碎
执念已碎 2021-01-15 09:36

Angular Material is awesome for creating colour-themed sites. As well is the usual palettes, you can create dynamic themes without SCSS, using directives like...

         


        
相关标签:
1条回答
  • 2021-01-15 09:48

    In case anyone is desperate to use md-colors as a hover state, its not possible according to the docs. But I created a work-around by setting the background color with md-colors, and hiding it behind another element. The hover state then makes the top layer transparent, so it appears to be a dynamically set hover state!

    You can see an example here:

    https://codepen.io/anon/pen/oGqPeE

    the html layout looks like this :

    <ul ng-if="link" md-theme="myTheme">
    <li ng-repeat="linkObj in link" md-colors="{background:'primary'}">
      <a ng-href="{{linkObj.link_url}}" target="_blank" md-colors="{background:'accent'}">          <span ng-bind="linkObj.link_title" md-colors="{color:'accent'}"></span>
      </a>
    </li>
    </ul>
    
    0 讨论(0)
提交回复
热议问题