caspian154 / beer-shelf

3 stars 1 forks source link

Angular: Routing and template question #5

Open caspian154 opened 7 years ago

caspian154 commented 7 years ago

The templates for my routes all have <main-header></main-header>, is there a way to just add that to index.html

MichaelWashburnJr commented 7 years ago

I'm not sure about locationProvider, but using stateProvider you can set a templateUrl and just point it to the html file.

  config(function($stateProvider, $urlRouterProvider) {
    // Learn more here: https://github.com/angular-ui/ui-router
    // Set up the various states which the app can be in.
    // Each state's controller can be found in controllers.js
    $stateProvider

    .state('recipes', {
      url: '/recipes',
      cache: false,
      templateUrl: 'recipe/list.html',
      controller: 'MyRecipesCtrl'
    });
}