wesbos wesbos - 3 months ago 7
AngularJS Question

Angular $routeParams is blank

I have a really simple Angular app that I've distilled to the following:

var napp = angular.module('Napp',['ngResource']);

var CompanyCtrl = function($scope, $routeParams, $location, $resource) {

napp.config(['$routeProvider', function($routeProvider) {
{templateUrl: '/partials/edit', controller: 'CompanyCtrl'}

and the HTML:

<div ng-controller="CompanyCtrl"></div>

When I log $routeParams, it comes up blank. When I use .otherwise(), it will load whatever I've specified there. Any idea what I'm missing?


First of all try this with


That should fix your starting code. Then adjust your code to support non-pushState browsers.

Hope this helps!