javascript - Why ng-class-even required extra quotes -


i working on angularjs codes fine stuck @ 1 place cant find why quotes required in ng-class-even directive.

in line <tr ng-repeat="x in records" ng-class-even='"striped"'> why striped written "'striped'" instead of "striped"

.striped {      color:white;      background-color:black;  }
<body ng-app="myapp">  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>    <table ng-controller="myctrl">  <tr ng-repeat="x in records" ng-class-even="'striped'">    <td>{{x.name}}</td>    <td>{{x.country}}</td>    </tr>  </table>    <script>  var app = angular.module("myapp", []);  app.controller("myctrl", function($scope) {    $scope.records = [      {        "name" : "alfreds futterkiste",        "country" : "germany"      },      {        "name" : "berglunds snabbköp",        "country" : "sweden"      },      {        "name" : "centro comercial moctezuma",        "country" : "mexico"      },      {        "name" : "ernst handel",        "country" : "austria"      }    ]  });  </script>    </body>

this because ng-class-even allows give expression. in question says:

n line why striped written "'striped'" instead of "striped"

if try this, angular thinks striped variable attached in $scope. using 'striped' tells angular expression passed directive string value


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -