我正在编写一个 Angular 应用程序,该应用程序与已在使用的 Google Analytics API 交互。Google 返回的数据以“ga:”为前缀,如示例“ga:newVisits”。
如果我使用表达式 {{total.ga:newVisits}},Angular 无法解析它。任何试图逃避冒号继续的尝试都会导致错误或完全逃避我的表达。
如何将 {{total.ga:newVisits}} 传递给 Angular 以便表达式正常工作?
<!doctype html>
<html ng-app="AnalyticsApp">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js"></script>
<script src="angular-controller.js"></script>
</head>
<body ng-controller="AnalyticsCtrl">
<ul>
<li ng-repeat="total in result">
{{total.ga:newVisits}}
</li>
</ul>
</body>
</html>