Angular ui-router $location

I’m trying to implement Angular ui-router on a wordpress single page template. This is my app.js:

angular
    .module('app', [
    'ui.router'
])

.config(['$urlRouterProvider', '$stateProvider', function($urlRouterProvider, $stateProvider){
    $urlRouterProvider.otherwise('/');

    $stateProvider
        .state ('home', {
            url: '/',
            templateUrl: '../../wp-content/themes/my_theme/templates/home.html'
        })
        .state ('about', {
            url: '/about',
            templateUrl: '../../wp-content/themes/my_theme/templates/about.html'
        })
}])

Now my question is: how can I replace my templateUrl with the Angular $location.path() function in order to make my script more stable?

Related posts

1 comment

  1. Yes,

    I would use get_template_directory_uri(); in your functions.php to pass the location to your app.

Comments are closed.