javascript - angular change view url parameters -
i'm trying navigate different view in angularjs app using url parameters. i've tried this
<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});   and using $stateprovider
<a ui-sref="devices({resourceview: 'devicegroupview', explorerview: 'table', type: 'device', uuid: treecurrentnode.uuid})">{{treecurrentnode.displayname}}</a>   my state provider code looks this:
.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,   i tried using $stateprovider using $state.go this
<a href="" ng-click="go(treecurrentnode.uuid)">{{treecurrentnode.displayname}}</a>   js:
$state.go('devices', {resourceview: 'devicedetailsview', explorerview: 'table', type: 'device', uuid: uuid})   but parameters not being added url. url i'm taken when don't try add parameters this:
$location.path('/devices')   has resourceview , explorerview parameters in there default, not type , uuid.
please try change stateprovider code follows see if works. worked of me.
.state('devices', {     url: "/devices/:resourceview/:explorerview/:type/:uuid",     params: {         resourceview: null,         explorerview: null,         type: null,         uuid: null     },     templateurl: "app/main/devices/module/views/devices.html",     controller: "devicesextendedctrl",     reloadonsearch: false,      
Comments
Post a Comment