search

Home  >  Q&A  >  body text

angular.js - angular ng-class里面可以用 {{}} 取值吗

angular ng-class里面可以用 {{}} 取值吗

迷茫迷茫2743 days ago553

reply all(1)I'll reply

  • 为情所困

    为情所困2017-05-15 17:15:35

    Thanks for the invitation, for all uses of ng-class, you can view the-many-ways-to-use-ngclass


    Data

    $scope.users = [
    {
      id: 1,
      name: `Lolo`,
      icon: true
    }, {
      id: 2,
      name: 'Semlinker',
      icon: false
    }];

    HTML Template

     <ul>
       <li ng-repeat="user in users" ng-class="{'tab': user.icon}">
          {{user.id}} - {{user.name}}
       </li>
     </ul>

    reply
    0
  • Cancelreply