1
我做一個基本的Restangular
例子,它適用於AngularJS 1.1
,但是在1.2
,該REST
請求被髮送,接收數據,但無法正確顯示錶。簡單restangular例如破與AngularJS 1.2
我在這裏通過一些線索閱讀了關於從1.1 to 1.2
升級的問題,但我沒有看到問題,因爲該示例非常簡單,並且沒有明確使用ngRoute
,隔離範圍或自定義指令。
HTML
<!DOCTYPE html>
<html ng-app="countries">
<head>
<meta charset="utf-8" />
<title>REST Country Example</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<script src="//code.angularjs.org/1.2.27/angular.min.js"></script>
<script src="//code.angularjs.org/1.2.27/angular-resource.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js"></script>
<script src="//cdn.rawgit.com/mgonto/restangular/master/dist/restangular.min.js"></script>
<script src="app.js"></script>
</head>
<body ng-controller="mainCtrl">
<div>
<h2>Restangular Example with RESTCountries.eu</h2>
<input type="text" ng-model="search" class="search-query" placeholder="Search">
<table class="table table-responsive table-striped">
<thead>
<tr>
<th>Country</th>
<th>Capital</th>
<th>Code</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="country in countries | filter:search | orderBy:'name'">
<td>{{country.name}}</td>
<td>{{country.capital}}</td>
<td>{{country.alpha2Code}}</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
JS
app = angular.module('countries', ['restangular']);
app.config(function(RestangularProvider) {
RestangularProvider.setBaseUrl('http://restcountries.eu/rest/v1');
});
app.controller('mainCtrl', function($scope, Restangular) {
$scope.countries = Restangular.all('all').getList();
});
任何知道什麼是小姐ing /不正確,爲了使這個工作正常的1.2?
乾杯,
AAAAH ...你說得對,我忽略了除承諾在1.2中解開。 由於fa6e411d,許解包已被刪除。自1.2.0-rc.3開始已被棄用。它不能再被打開。兩種方法已被刪除: $ parseProvider.unwrapPromises $ parseProvider.logPromiseWarnings 感謝您的幫助。 – 2014-12-19 09:45:35