我想将参数与$state.go一起发送为:
var catPadre = $scope.catalogoPadre;
$state.go("root.catalogosgenericos", catPadre);我将下列参数作为参数传递:
.state('root.catalogosgenericos', {
url: "catalogosGenericos.html/",
templateUrl: "../SPA/administrador/catalogos/catalogosGenericos.html",
controller: "catalogosGenericosCtrl",
params: {
catPadre: null
},
authenticate: true
})我在角控制器中注入了如下所示的依赖关系:
function catalogosGenericosCtrl($scope, apiService, notificationService, $rootScope, $location, $http, $state, $filter) {当我使用add $stateParams时会出现问题,如下所示:
function catalogosGenericosCtrl($scope, apiService, notificationService, $rootScope, $location, $stateParams, $http, $state, $filter) {它在控制台上抛出问题,上面说:
$state未定义
我不明白是怎么回事,为什么我的$stateParams与$state的定义冲突。谁能解释一下吗?
发布于 2017-07-20 06:19:39
尝试使用以下解决方案:
var catPadre = $scope.catalogoPadre;
$state.go("root.catalogosgenericos", {catPadre:$scope.catalogoPadre});在您的路由文件中,更改代码如下:
.state('root.catalogosgenericos', {
url: "/catalogosGenericos/ :catPadre",
templateUrl: "../SPA/administrador/catalogos/catalogosGenericos.html",
controller: "catalogosGenericosCtrl",
authenticate: true
})更改控制器功能:
function catalogosGenericosCtrl($scope, apiService, notificationService, $rootScope, $location, $http, $state,$stateParams, $filter) {https://stackoverflow.com/questions/45200858
复制相似问题