Ok so I am trying to combine both nested and multiple views with angular-ui-router.
I have the following HTML:
Index.html
<div ui-view="viewA"></div>
viewA.html
index.viewA
<div ui-view="viewANested"></div>
viewANested.html
index.viewA.nested
And the following javascript:
var myapp = angular.module('myapp', ["ui.router"])
myapp.config(function($stateProvider){
$stateProvider
.state('index', {
url: "",
views: {
"viewA": {
templateUrl: "viewA.html",
views: {
"viewANested":{
templateUrl: "viewANested.html"
}
}
}
}
});
})
A plunker is here, I am trying to combine both multiple and nested views but it isn't working for me. I can see the outer view just fine but no joy in the inner one, with no errors in the console.
For the sake of simplicity I have removed the multiple views from the example, but the HTML/Javascript wouldn't change in structure if they were there.
I have tried this javascript also:
myapp.config(function($stateProvider){
$stateProvider
.state('index', {
url: "",
views: {
"viewA": {
templateUrl: "viewA.html",
}
"viewANested": {
templateUrl: "viewANested.html",
}
}
});
})
This isn't working either (combined with changing the ui-view property to 'viewA.Nested'):
myapp.config(function($stateProvider){
$stateProvider
.state('index', {
url: "",
views: {
"viewA": {
templateUrl: "viewA.html"
},
"viewA.Nested":{
templateUrl: "viewANested.html"
}
}
});
})
Still no joy, I can't think of any other way to do this, can somebody shed some light on where I am going wrong?
Am I making a mistake or is this a limitation of the framework itself?
I think the alternative is to have a flatter structure, and extra mostly unused divs on my index page that I can use if neccessary to put content into for more complex pages, is that the way to go? It seems a bit hacky.
Thanks