AngularJS和波斯语(阿拉伯语)字符的问题

时间:2015-08-24 06:35:53

标签: javascript angularjs angularjs-directive arabic persian

我在我的项目中使用AngularJS并且它在英语中正常工作,但是当我想要例如从查询搜索得到结果时我在控制台中遇到错误:

HTML中的

<!DOCTYPE html>
<html ng-app="myapp">
<head lang="en">
    <meta charset="UTF-8">
    <title>project</title>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js"></script>
    <script src="info.js"></script>
</head>
<body>
<div ng-controller="CompanyInfo">
    <label for="search">
        <input type="text" ng-model="query" id="search"/>
    </label>
    <select name="select" id="">
        <option value="name">Name</option>
        <option value="founder">Founder</option>
    </select>
    <label for=""><input ng-model="direction" name="direction" value="reverse" type="radio"/>Descending</label>
    <label for=""><input ng-model="direction" name="direction" type="radio"/>Ascending</label>
    <ul>
        <li ng-repeat="item in inform | limitTo: 10 | filter: query | orderBy: query:direction">{{item.name | uppercase}}, {{item.founder}}</li>
    </ul>
</div>
</body>
</html>

JS:

var myapp = angular.module('myapp', []);

myapp.controller('CompanyInfo', ['$scope', '$http', function($scope, $http){
    $http.get('data.json').success(function(data){
        $scope.inform = data;
    });
}]);

错误:

Error: [$parse:lexerr] http://errors.angularjs.org/1.4.4/$parse/lexerr?p0=Unexpected%20next%20character%20&p1=s%200-0%20%5B%D8%B9%5D&p2=%D8%B9
    at Error (native)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js:6:416
    at ec.throwError (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js:198:58)
    at ec.lex (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js:196:481)
    at Object.s.ast (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js:201:465)
    at Object.rd.compile (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js:211:146)
    at fc.parse (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js:237:178)
    at $get (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js:116:396)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js:157:207
    at Array.map (native)

JSON:

[
  {
  "name": "booking online 1",
  "founder": "Alri"
  },
  {
  "name": "booking online 2",
  "founder": "Reza Valimoradi"
  },
  {
  "name": "booking online 3",
  "founder": "Alirezari"
  },
  {
  "name": "booking online 4",
  "founder": "Ali"
  },
  {
  "name": "booking online 5",
  "founder": "Ghaffari"
  },
  {
  "name": "رزرو اینترنتی",
  "founder": "غفاری"
  },
  {
  "name": "اینترنت",
  "founder": "مرادی"
  }
]

这是必要的,我该怎么办?

0 个答案:

没有答案