在下面的示例中,如果名称包含连字符('-'),则AngularJS表达式无法对此进行评估。结果是,值字段的值为'610'而不是'0610-FC2'。
var app = angular.module('myApp', []);
app.controller('namesCtrl', function($scope) {
$scope.names = [
'0610-FC2'
];
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.4/angular.min.js"></script>
<body>
<ul ng-app="myApp" ng-controller="namesCtrl" >
<li ng-repeat="n in names" value="{{n}}">{{n}}</li>
</ul>
</body>