特定の都市のイベントを含む JSON 文字列を投稿する $resource を Angular で作成しようとしています。
angular.module('mean.parties').controller('PartyByCityController', ['$scope', '$routeParams', '$location', '$resource',
function($scope, $routeParams, $location, $resource) {
$scope.findByCity = function() {
var testparties = $resource('/c/:city');
testparties.get({
city: 'copenhagen'
}, function(parties) {
$scope.parties = parties;
});
};
}
]);
それから私の見解では:
<section data-ng-controller="PartyByCityController" data-ng-init="findByCity()">
<div class='row'>
{{parties}}
</div>
</section>
これにより、次のエラーが発生します。
TypeError: Object #<Resource> has no method 'push'
Angular の外で /c/Copenhagen にアクセスすると、正常に動作します。誰かがここで何が悪いのか分かりますか?