How to correctly use ng-View with md-tabs in AngularJS and Angular Material -


i trying use angular material md-tabs in web site each tabs represents different url determined using ng-view tag. web site here: here. visually works i'm noticing pages loaded 5 times every time change tab .... once each tab location.

is there setting or need change correctly?

the code tabs follow:

       <div class="tabsdemodynamicheight">         <md-content class="md-padding">             <md-tabs md-dynamic-height md-border-bottom md-selected="selectedindex">                 <md-tab label="featured">                     <md-content class="md-padding">                         <div ng-view></div>                     </md-content>                 </md-tab>                 <md-tab label="art sale">                     <md-content class="md-padding">                         <div ng-view></div>                     </md-content>                 </md-tab>                 <md-tab label="philosophy">                     <md-content class="md-padding">                         <div ng-view></div>                     </md-content>                 </md-tab>                 <md-tab label="policies">                     <md-content class="md-padding">                         <div ng-view></div>                     </md-content>                 </md-tab>                 <md-tab label="contact us">                     <md-content class="md-padding">                         <div ng-view></div>                     </md-content>                 </md-tab>               </md-tabs>         </md-content>     </div> 

for still interested in this: need use md-on-select directive call function in controller redirect url understood $routeprovider, instance:

<body ng-app="app" ng-controller="appcontroller vm" layout="column"> : <md-content flex>   <md-tabs md-dynamic-height md-border-bottom md-stretch-tabs="always">     <md-tab md-on-select="vm.tabdashboard()">       <md-tab-label>         <md-icon>dashboard</md-icon>&nbsp;dashboard       </md-tab-label>     </md-tab>     <md-tab md-on-select="vm.tabreports()">       <md-tab-label>         <md-icon>trending_up</md-icon>&nbsp;reports       </md-tab-label>     </md-tab>     <md-tab md-on-select="vm.tabmanageemployee()">       <md-tab-label>         <md-icon>people</md-icon>&nbsp;manage employee       </md-tab-label>     </md-tab>      :      :   </md-tabs>   <div ng-view></div> </md-content> : </body> 

and in appcontroller this:

(function () { angular.module('app', ['ngmaterial', 'ngroute', 'ngresource', 'md.data.table'])     .controller('appcontroller', appcontroller)     .config(function ($routeprovider) {         $routeprovider             .when('/dashboard', {                 templateurl: '/views/dashboard.html'             })             .when('/reports', {                 templateurl: '/views/reports.html'             })             .when('/manageemployee', {                 templateurl: '/views/manageemployee.html'             })             .otherwise({                 templateurl: '/views/otherwise.html'             });     });  function appcontroller($mdmedia, $scope, $http, session, $location) {     var vm = this;     vm.tabdashboard = function () {         $location.path('/dashboard');     };     vm.tabreports = function () {          $location.path('/reports');     };     vm.tabmanageemployee = function () {          $location.path('/manageemployee');     }; } })(); 

hope helps.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -