Skip to content


Subversion checkout URL

You can clone with
Download ZIP


AngularJS templates are removed from page. #97

zeelux opened this Issue · 5 comments

3 participants


When an AngularJS template is included in the page the entire script block for it is removed from the page and jsperf uses the id of that script block to attempt to load the template from the site.

For example:

<script type="text/ng-template" id="someTemplate">

will result in the block being removed and an attempt to load


@mathiasbynens It seems to be a url rewrite rule that will take someTemplate and map it to some.


I’m confused. Is the example supposed to be just <div></div>? redirects to as we don’t support uppercase in slugs. This is intended behavior.


Sorry the example I gave didn't render the script tags before. I have encoded it so it will show up correctly. As you can now see, I'm not referencing a script using the source it's an inline template using the AngularJS syntax.


@zeelux Can you give an example jsPerf test case where this issue occurs?


After some more testing I've found that it isn't that the template is removed from the page, it just gets moved to the bottom of the page with the javascript blocks. This is a problem for AngularJs as the templates must be enclosed in the same html tag that has the "ng-app" attribute. You can see in the sample link below that the script tag is inside a div with the ng-app attribute in my markup but the resulting page when the test is run this is not the case. When the script is moved outside the scope of the angular bindings, angular will not find the template and will attempt to do an http get to pull the file from the server, assuming that the template name is the file name to load.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.