-1

I have following HTML structure

<% include header.html %>
<% include sidebar.html %>

<div class="robust-content content container-fluid">
  <div class="content-wrapper">
    <div class="content-header row"></div>
    <div class="content-body" ui-view></div>
  </div>
</div>

<% include footer.html %>

I should do first login page, where just blank page with First Setup Wizard exists without header, footer and sidebar. In another pages they exists.

I'm willing use ui.router, but in that case I should wrap all page into ui-view.

Is it ok to wrap entire page into ui-view - including header and footer and then define it in every template if needed?

Asking it, because want to define header, footer and sidebar once somewhere. And just change contents later.

Aluan Haddad
  • 23,170
  • 5
  • 56
  • 69
Ngorco
  • 39
  • 4

1 Answers1

0

Solution is

app.js

app.config(function($urlRouterProvider, $stateProvider) {

    $urlRouterProvider.otherwise('/dashboard');
    $stateProvider
    .state('dashboard', {

        templateUrl: './pages/index.html'
    })
    .state('dashboard.home', {

        url: '/dashboard',
        templateUrl: './pages/dashboard.home.state.html'
    })
    .state('setup', {

       url: '/setup',
       templateUrl: './pages/setupwizard/setupwizard.html',
       controller: 'setupWizardController'
    });
});

index.html

<div id="app" ui-view></div>  

pages/index.html

<div ng-include="'pages/commons/header.html'"></div>
<div ng-include="'pages/commons/sidebar.html'"></div>

<div class="robust-content content container-fluid">
     <div class="content-wrapper">
         <div class="content-header row"></div>
         <div class="content-body" ui-view></div>
     </div>
</div>

<ng-include src="'pages/commons/footer.html'"></ng-include>

pages/dashboard.home.state.html

<div class="row">
     <div class="col-lg-12 col-md-12 col-xs-12">
         <div class="widget-holder">

         </div>
     </div>
</div>

If user went to dashboard he'll never get to setupWizard(except first time), so headers etc loads once always.

Ngorco
  • 39
  • 4