3

I am still learning the UI-Router for AngularJS and have was hoping to get some help. I am taking advantage of the nested views functionality, but running into some hiccups. My top level parent state works, but as soon as I start creating children, the template URL's start acting up. Its as if the templateUrl's aren't dynamic to their top level parent. Am I naming the template/view files incorrectly? I did my best to follow the sample contacts app provided on the repo.

projectsApp.js

var app = angular.module('scynergyApp.projects', ['ui.router']);

app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouteProvider){

$stateProvider

    //////////////
    // Projects //
    //////////////
    .state('projects',{
        url: '/projects',
        templateUrl: 'app/projects/projects.html'  // THIS TEMPLATE URL WORKS
    })

        /////////////////////////
        // Projects > Details /// 
        /////////////////////////
        .state('projects.details', {
          url: '/details',
          templateUrl: 'app/projects/projects.details.html'  // THIS TEMPLATE URL DOESNT WORK -> only if its '../app/projects/projects.details.html'
        })

            ///////////////////////////////////
            // Projects > Details > Overview //
            /////////////////////////////////// 
            .state('projects.details.overview', {
              url: '/overview',
              templateUrl: 'app/projects/projects.details.overview.html'  // THIS TEMPLATE URL DOESNT WORK -> only if its '../app/projects/projects.details.html'
            });
}]);

File tree

public
        app
            projects
                ProjectsController.js
                projectsApp.js  //dependency of app.js
                projects.html
                projects.details.html
                projects.details.overview.html
            app.js

Any direction on this would be greatly appreciated. Thank you

Austin
  • 75
  • 2
  • 6

1 Answers1

3

you should better use absolute paths mapping from project root like /app/projects/blabla

bahadir
  • 709
  • 1
  • 11
  • 28
  • 2
    actually i think this is an answer for the question, but i cant comment to any other posts anyways – bahadir Dec 24 '14 at 08:19