# AngurlarJS And Roots

**URL:** https://discourse.roots.io/t/angurlarjs-and-roots/1965
**Category:** uncategorized
**Created:** 2014-07-19T17:32:51Z
**Posts:** 10
**Showing post:** 4 of 10

## Post 4 by @xav — 2015-05-26T19:23:46Z

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](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

---

_[View the full topic](https://discourse.roots.io/t/angurlarjs-and-roots/1965)._
