Working with sailjs and angular has been causing me some issues. Specifically, when I make a GET
request using the URL
cate/:id/new
, my link ends up looking like
http://localhost:1337/category/5540ba9975492b9155e03836/new
How does angular recognize my ID in this scenario?
I've tried using ngRoute, but when I console.log it, it just returns Object {}
Here's my module.js
:
angular.module('DeviceModule', ['toastr', 'ngRoute']);
And here's my controller.js
:
angular.module('DeviceModule').controller('DeviceController', ['$scope', '$http', 'toastr', '$routeParams', function($scope, $http, toastr, $routeParams){
$scope.params = $routeParams;
console.log($scope.params);
}])
.config(function($routeProvider, $locationProvider) {
$routeProvider
.when('/category/:Id/new', {
//templateUrl: 'book.html',
controller: 'DeviceController',
})
});