Grunt build hangs on ngtemplates:dist

I just ran into a strange situation where grunt build on a Yeoman Angular project was hanging at the following step:

$ grunt build
⋮
Running "ngtemplates:dist" (ngtemplates) task

The cause turned out to be an extra double quote symbol in one of the HTML view templates:

<form method="get" action="#" onsubmit="window.location='#/results/' + query.value; return false;"">

A git bisect helped reveal the problematic revision, but even so it took a lot of trial and error to find the cause. The challenge was that Grunt gave no clues as to what might be causing it to stall. It also didn't crash, rather sat there in an infinite loop merrily consuming the CPU.

Interesting, the problem doesn't occur for just any old extra quote, so I'd guess that means that Angular is trying to parse this snippet of JavaScript and getting stuck. And yes, I agree that this is a very un-Angular way to submit a form. :)

(my software/consulting business)

links

social

Supporting

FSF member since 2006 Become a Conservancy Supporter!