我有这样的状态定义:
$stateProvider.state('password', {
url: '/password',
templateUrl: 'password.html',
controller: 'PasswordController',
controllerAs: 'ctrl',
params: {
accountNumber: {
value: null,
squash: true
}
},
});
我需要用它href
而不是使用ui-serif
指令来引用这个状态,我怎样才能params.accountNumber
在href里面设置?
这不起作用:
$state.href('password', {accountNumber: $scope.accountNumber})
当我将此行更改url: '/password',
为 `url: '/password?accoutNumber',并删除这部分
params: {
accountNumber: {
value: null,
squash: true
}
},
$state.href
工作得很好。