javascript - Dynamically redirect to another view in to div in main view -


i'm trying load view in div in main view. main view

<html>  <head>   //some contents  </head>  <body>   <div class="contents" id="subcontents" ng-controller="distributeviewscontroller" ng-view>       //other view loaded hear     </div>  </body> </html> 

this index view

<html>  <body>   //contents  </body> </html> 

i'm using angular routing route index view in main view. js

$routeprovider  .when('/index', {    templateurl: 'ez_main/index',    controller: 'distributeviewscontroller'  }) 

routing work fine <a href="#index">index</a> want load index view dynamically. let have 2 views called index , home. need call main view first , after load index or home according request(the request need load main view , after go index or home view).can tell me how can if method possible or way that.

use below code :

$routeprovider.when('/main/:page', {templateurl: 'views/main.html', controller: 'main.mainviewctrl'});


Comments