Hi there,
I have a routing problem I’m not able to solve.
In a view I have a button defined as follow:
<button class="button button-positive"
ng-click='newDemoLicense({{customerId}})'>
Add demo licence </button>
When I press the button the function in the controller is fired:
$scope.newDemoLicense = function(customerId){
console.log('new demo license id:'+ customerId);
$state.go('tab.license.demo',
{
'customerId': customerId,
'licenseId': null
});
};
The states are defined as:
...
.state('tab.license', {
url: '/license/:customerId/:licenseId',
views: {
'tab-customers': {
templateUrl: 'templates/tab-license.html',
controller: 'LicenseCtrl'
}
}
})
.state('tab.license.demo', {
url: '/licensedemo/:customerId',
views: {
'tab-customers': {
templateUrl: 'templates/tab-license-alt.html',
controller: 'DemoLicenseCtrl'
}
}
})
...
but with my surprise the page is redirected toward the URL:
http://localhost:8080/#/tab/license/1001//licensedemo/1001
(… I was in http://localhost:8080/#/tab/license/1001)
The page I see is tab-license.html and the recalled controller is the LicenseCtrl.
Seems the control is switched into the tab.license state: I guess it is caused by the #/tab/license in front to the required new URL.
Why the second URL was added to the previous URL?
Thanks!