I am trying to create a SPA angular application with nesting of named views. But not successful to create this setup. Can someone help me to point out my mistake?
On index page I have 2 named views, I able to see these two pages - viewA and viewB.
<!-index.html--->
<table>
<tr>
<td>
<div ui-view="viewA"></div>
</td>
<td>
<div ui-view="viewB"></div>
</td>
</tr>
</table>
On ViewA, I am not sure how to load another 2 named views - view1,view2. I am stuck here.
<!-viewA.html--->
<div>
<h3>This is view A</h3>
<table>
<tr>
<td>
<div ui-view="view1"></div>
</td>
<td>
<div ui-view="view2"></div>
</td>
</tr>
</table>
</div>
I got the configuration like this:
angular.module('myApp', ['ui.router']).config(function ($stateProvider, $urlRouterProvider) {
$stateProvider
.state('index', {
url: "",
views: {
"viewA": {
templateUrl: "partials/views/viewA.html"
},
"viewB": {
templateUrl: "partials/views/viewB.html"
}
}
}).state('index.viewA', {
views: {
"view1": {
templateUrl: "partials/views/view1.html"
},
"view2": {
templateUrl: "partials/views/view2.html"
}
}
});
});