Thanks for that, nice things.
Is too bad, I have the solution with WP.
But for the route I can’t got my variable path with javascript and Sage, but this is work well with the Hook, exemple:
I used with wp_localize_script()
http://codex.wordpress.org/Function_Reference/wp_localize_script
My name variable is ‘myLocalized’ and is equal:
‘myLocalized.partials’ === get_template_directory_uri().’/partials/’;
function my_scripts() {
wp_register_script(
'angularjs',
get_stylesheet_directory_uri() . '/bower_components/angular/angular.min.js'
);
wp_register_script(
'angularjs-route',
get_stylesheet_directory_uri() . '/bower_components/angular-route/angular-route.min.js'
);
wp_register_script(
'angularjs-sanitize',
get_stylesheet_directory_uri() . '/bower_components/angular-sanitize/angular-sanitize.min.js'
);
wp_register_script(
'my-jquery',
get_stylesheet_directory_uri() . '/bower_components/jquery/dist/jquery.min.js'
);
wp_enqueue_script(
'my-scripts',
get_stylesheet_directory_uri() . '/js/scripts.min.js',
array( 'my-jquery', 'angularjs', 'angularjs-route', 'angularjs-sanitize' )
);
wp_localize_script(
'my-scripts',
'myLocalized',
array(
'partials' => trailingslashit( get_template_directory_uri() ) . 'partials/'
)
);
}
add_action( 'wp_enqueue_scripts', 'my_scripts' );
then in route I call my variable to get the path template
$routeProvider
.when('/', {
templateUrl: myLocalized.partials + 'main.html',
controller: 'Main'
})
I’m using WP_API to get the data in main.html:
<a href="blog/{{post.ID}}" ng-bind-html="post.title"></a>
Any chance to get work with Sage + Angular + Route + Sanitize ?
I really want to build a theme with Sage and Angular.
EDIT:
I used
templateUrl: window.location.href.partials + ‘main.html’,
But I still get an error to load the module app