Changing Element Colour on Hover AngularJS

后端 未结 6 768
失恋的感觉
失恋的感觉 2021-02-07 12:50

So, I\'m just getting started with angularjs and I\'m already confused. I want to change the colour of a list element that corresponds to a hex code colour that is in an array.

6条回答
  •  南笙
    南笙 (楼主)
    2021-02-07 13:41

    If you check an example here you will see that ng-style directive waits for css style, not just value, so in your case it'll be:

    $scope.person.colourStyle={'background-color':$scope.persons.color}
    

    and in html it'll be:

  • < href="#/{{i.person_id}}">{{i.person_name}}
  • edit:

    And You also need to set colour value to full hex for example: '#cc0000'.

提交回复
热议问题