Any idea why $routeParams is logging undefined? I would expect it to log an id.
var app = angular.module('Example', ['ngResource', 'ngRoute']);
app.config([
'$routeProvider', function($routeProvider) {
return $routeProvider.when('/entries/:entryId', {
controller: 'EntryController'
});
}
]);
app.controller('EntryController', [
'$scope', '$routeParams', '$http', function($scope, $routeParams, $http) {
$http.get("/entries/" + $routeParams.entryId + ".json").success(function(data) {
return $scope.phone = data;
});
// This logs undefined.
console.log($routeParams.entryId);
}
]);
Current URL is http://localhost:3000/entries/5383a2f44d6f6816d7020000