Below is the current code snippet:
let views = { '': 'app/content.html' };
.state('auto', {
url: '/automated',
redirectToChild: {
state: 'auto.index'
},
views: view
})
.state('auto.index', {
url :'',
templateUrl: '/app/automated/automated.html'
})
.state('auto.visit', {
url: '/visit',
views: {
'': {templateUrl: '/app/automated/visit.html'}
}
})
.state('auto.visit.create', {
url: '/create',
views: {
'': {templateUrl: '/app/automated/_form.html'}
}
})
Here is the corresponding HTML:
// index.html
<ui-view></ui-view>
// content.html
<div class="wrapper">
<div class="container">
<ui-view> </ui-view>
</div>
</div>
// visit.html
<h5>Visit Page</h5>
// form.html
<h5>Visit Form</h5>
Issue at hand: Everything is functioning correctly with this code except when navigating to auto.visit.create
state, it displays visit.html
instead of '_form.html'.
How can I update the content of visit.html
without altering the existing routes?
First Attempt:
I changed my auto.visit.create
state to auto.visit-create
. This corrected the issue but I prefer to keep create
nested under auto.visit
Second Attempt:
I added a new <ui-view></ui-view>
in visit.html, however, when navigating to the create
page, it continues to display the content of visit.html.
I have also attempted to follow the example provided here http://angular-ui.github.io/ui-router/sample/#/, unfortunately, with no success.