私のようにapp.js
見える
var app = angular.module('pennytracker', [
'$strap.directives',
'ngCookies',
'categoryServices'
]);
app.config(function($routeProvider) {
console.log('configuring routes');
$routeProvider
.when('/summary', { templateUrl: '../static/partials/summary.html'})
.when('/transactions', { templateUrl: '../static/partials/transaction.html', controller: 'AddTransactionController' })
});
私app/js/services/categories.js
のように見えますが
angular.module('categoryServices', ['ngResource']).
factory('Category', function($resource){
return $resource(
'/categories/:categoryId',
{categoryId: '@uuid'}
);
});
そして、私は次のようなルートを持っています
.when('/transactions', { templateUrl: '../static/partials/transaction.html', controller: 'AddTransactionController' })
私のコントローラーapp/js/controllers/transactionController.js
は次のようになります
function AddTransactionController($scope, $http, $cookieStore, Category) {
// some work here
$scope.category = Category.query();
console.log('all categories - ', $scope.category.length);
}
アプリを実行すると、console.log が次のように表示されます。
all categories - 0
ここで私が間違っていることは何ですか?