我用sailjs有角度的问题是当我GET
用URLcate/:id/new
我的链接就像http://localhost:1337/category/5540ba9975492b9155e03836/new
知道我的ID有多大角度?
我尝试了ngRoute,但是当我console.log时返回 Object {}
我的 module.js
angular.module('DeviceModule', ['toastr', 'ngRoute']);
我的 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',
})
});
您可以将其拉出$location.path()
,但是如果您要进行有角度的内部导航,则以某种方式将其写到页面上或跟踪ID可能更有意义。有了您的网址,它看起来就不一样了。
考虑一下/objects/id1/subobjects/id2
。使用URL将ID信息传达给应用程序似乎有点麻烦。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句