wesbos wesbos - 1 year ago 92
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?

Answer Source

First of all try this with


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

Hope this helps!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download