我正在尝试使用url参数导航到angularjs应用中的不同视图。我已经试过这样的事情角度更改视图url参数
<a href="" ng-click="goToDevice(treeCurrentNode.uuid)">{{treeCurrentNode.displayName}}</a>
JS:使用
$location.path('/devices').search({resourceView: 'deviceDetailsView'})
.search({explorerView: 'table'}).search({type: 'Device'}).search({uuid: uuid});
而且像这样的东西$stateProvider
<a ui-sref="Devices({resourceView: 'deviceGroupView', explorerView: 'table', type: 'Device', uuid: treeCurrentNode.uuid})">{{treeCurrentNode.displayName}}</a>
我的状态提供的代码如下所示:
.state('Devices', {
url: "/devices",
params: {
resourceView: null,
explorerView: null,
type: null,
uuid: null
},
templateUrl: "app/main/devices/module/views/devices.html",
controller: "DevicesExtendedCtrl",
reloadOnSearch: false,
我也是Ø尝试使用$stateProvider
使用$state.go
这样
<a href="" ng-click="go(treeCurrentNode.uuid)">{{treeCurrentNode.displayName}}</a>
JS:
$state.go('Devices', {resourceView: 'deviceDetailsView', explorerView: 'table', type: 'Device', uuid: uuid})
但参数没有被添加到URL。该网址我心有所属时,我不尝试添加的参数是这样的:
$location.path('/devices')
默认情况下在那里的ResourceView和explorerView参数,而不是类型和UUID。
即将关闭。我应该提到,当我不尝试添加任何参数时,我指向的默认url已经将resourceView和explorerView添加为参数。当我改变这样的代码时,它具有resourceView和explorerView作为参数,但它在参数前面将上下文路径添加了type和uuid – gary69