I have a really simple Angular app that I\'ve distilled to the following:
var napp = angular.module(\'Napp\',[\'ngResource\']);
var CompanyCtrl = function($scop
You have a couple of errors:
You've specified the controller in two places, both in the view () and in $routeProvider (
.when('/company/edit/:id', {templateUrl: '/partials/edit', controller: 'CompanyCtrl'}
). I'd remove the one in the view.
You have to register the controller in the module when specifying it in the $routeProvider (you should really do this anyway, it's better to avoid global controllers). Do napp.controller('CompanyCtrl', function ...
instead of var CompanyCtrl = function ...
.
You need to specify a ng-view when you're using the $route service (not sure if you're doing this or not)
The new code:
var napp = angular.module('Napp', ['ngResource']);
napp.controller('CompanyCtrl', function ($scope, $routeParams, $location, $resource) {
console.log($routeParams);
});
napp.config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when('/company/edit/:id',
{templateUrl: '/partials/edit', controller: 'CompanyCtrl'}
);
}]);
The template (/parials/edit)
...
And the app (index.html or something)
...
I've created a working plunker example: http://plnkr.co/edit/PQXke2d1IEJfh2BKNE23?p=preview