For routing used 'native' for angular ngRoute. I didn’t have to display two or more templates in two different places on the same page for a given url. Here is the old code, one template in one place <ng-view>
.when('/page:page',{ templateUrl:function(params) {return basePath+'index'+params.page+'.html';}, controller: 'lessonPageCtrl' }) .when('/',{ templateUrl:function() {return basePath+'index.html';}, controller: 'lessonPageCtrl' })
Had to be replaced by:
$stateProvider .state('page', { url: 'page:page', views: { 'leftPage': { templateUrl: function (stateParams){ return basePath+'indexL'+ stateParams.page + '.html'}, controller: 'lessonPageCtrl' }, 'rightPage': { templateUrl: function (stateParams){ return basePath+'indexR'+ stateParams.page + '.html'}, controller: 'lessonPageCtrl' } } })
Displayed in
<div ui-view="leftPage"></div> <div ui-view="rightPage"></div>
The problem is that with the second option using ui-router <div ui-view=""></div>
empty, until you click on the link <div ui-view=""></div>
<a ui-sref="page({page: $index})">link</a>
. Which is very bad. It is necessary that the view is immediately displayed depending on the url as in the first version using nRout. How to solve the problem that advise?
ng-view
could just be replaced byng-include
- Grundy