javascript - Angular route with sailsjs -
i use sailjs angular problem when get
url cate/:id/new
link http://localhost:1337/category/5540ba9975492b9155e03836/new
how angular know id is?
i have try ngroute when console.log return object {}
my module.js
angular.module('devicemodule', ['toastr', 'ngroute']);
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', }) });
you pull out of $location.path()
, may make more sense write page somehow on load or keep track of ids if you're doing internal navigation in angular. given url, doesn't are.
consider /objects/id1/subobjects/id2
. using url convey id information application seems little dicey.
Comments
Post a Comment