In AngularJS, any inline javascript code that included in HTML templates doesn’t work

jQlite does not support script tags. jQuery does, so the recommendation is to include jQuery if you need this functionality.

From Angular’s Igor Minar in this discussion:

we looked into supporting script tags in jqlite, but what needs to be
done to get a cross-browser support involves a lot of black magic. For
this reason we decided that for now we are just going to recommend
that users use jquery along with angular in this particular case. It
doesn’t make sense for us to rewrite one third of jquery to get this
working in jqlite.

Here’s the related github issue jqLite should create elements in same way as jQuery where Igor sums up, before closing the issue, with this:

This is too much craziness for jqlite, so we are not going to do it.
Instead we are going to document that if you want have script elements
in ng:include or ng:view templates, you should use jquery.

demo plunker with jquery

Leave a Comment