× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

Wordpress and Angular get tricky with dependencies.

Hassan Bazzi
Oct 13, 2015
<p>When developing Angular within Wordpress, you need to make sure WordPress is enqueuing scripts in the correct order.</p> <p> </p> <p>Angular should load first, which should depend on JQuery. After that, you need to reload the core angular parts (ui-router, etc..). After all that loads, you need to load your main app's entry point (usually app.js) and that should depend on your core Angular. Then after that, all your directives and files should be loaded and should depend on app.js</p> <p>Your router will also get tricky. You're no longer in your root directory when grabbing template URLs for your router, you're now inside WordPress's theme folder. So anything like '/template/page.html' needs to be converted to /wp-content/themes/your-theme/template/page.html'</p> <p>This needs more elaboration, but I figured I'd write a quick tip. :)</p>
comments powered by Disqus