Mostly PJAX site with some AngularJS
Posted
by
jrhicks
on Stack Overflow
See other posts from Stack Overflow
or by jrhicks
Published on 2012-10-14T21:39:28Z
Indexed on
2012/10/20
23:01 UTC
Read the original article
Hit count: 371
I have a site using PJAX all over the place and I have a few pages that are using AngularJS. For the AngularJS pages I would like to continue to use PJAX to get all the benefits associated with not reloading the entire HTML page, assets etc. Unfortunately, PJAX just loads some HTML into the page and doesn't fire any javascript. This is okay, because I can fire the javascript manually on pjax success, but I can't quite figure out what makes AngularJS initialize.
For a simple scenario, lets say I AJAX the following HTML into a page. Also assume, the page already had Angular.js included. What could I call to have the following behave like an Angular App?
<div>
<label>Name:</label>
<input type="text" ng-model="yourName" placeholder="Enter a name here">
<hr>
<h1>Hello {{yourName}}!</h1>
</div>
Thanks
© Stack Overflow or respective owner