my app.js looks like
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' }) });
while my app/js/services/categories.js looks like
angular.module('categoryServices', ['ngResource']). factory('Category', function($resource){ return $resource( '/categories/:categoryId', {categoryId: '@uuid'} ); });
and I have a route like
.when('/transactions', { templateUrl: '../static/partials/transaction.html', controller: 'AddTransactionController' })
and my controller app/js/controllers/transactionController.js looks like
function AddTransactionController($scope, $http, $cookieStore, Category) { // some work here $scope.category = Category.query(); console.log('all categories - ', $scope.category.length); }
When I launch my application, I see console.log as
all categories - 0
What am I doing wrong here?
source share