I have a parent and a child state. The parent state is used to View/Edit customers, the child state is to create. Without a parameter on the parent state, they both load fine:
.state('crm.customer', {
url: 'crm/customers/',
templateUrl: 'src/modules/crm/views/customer.html',
controller: 'customersController'
})
.state('crm.customer.create', {
url: 'crm/customers/create',
templateUrl: 'src/modules/crm/views/customer.html',
controller: 'customersController'
})
When I add the customerId parameter to the parent state, and I load the child state, first the child state loads, and then immediately it switches to the parent state:
.state('crm.customer', {
url: 'crm/customers/:customerId',
templateUrl: 'src/modules/crm/views/customer.html',
controller: 'customersController'
})
.state('crm.customer.create', {
url: 'crm/customers/create',
templateUrl: 'src/modules/crm/views/customer.html',
controller: 'customersController'
})
How can I prevent the parent state from loading after the child state loads?
/crm/customers/createpath. In this case, the:customerIdtakes the value ofcreate. tryurl: 'crm/customers/{customerId:int}'instead ofurl: 'crm/customers/:customerId'