-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
javascript < is evaluated as invalid html and throws parse error #102
Comments
Can you post up the templatized version of Have you tried using what's compiled for Bower?
angular.module("template/rating/rating.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("template/rating/rating.html",
"<span ng-mouseleave=\"reset()\" ng-keydown=\"onKeydown($event)\" tabindex=\"0\" role=\"slider\" aria-valuemin=\"0\" aria-valuemax=\"{{range.length}}\" aria-valuenow=\"{{value}}\">\n" +
" <i ng-repeat=\"r in range track by $index\" ng-mouseenter=\"enter($index + 1)\" ng-click=\"rate($index + 1)\" class=\"glyphicon\" ng-class=\"$index < value && (r.stateOn || 'glyphicon-star') || (r.stateOff || 'glyphicon-star-empty')\">\n" +
" <span class=\"sr-only\">({{ $index < value ? '*' : ' ' }})</span>\n" +
" </i>\n" +
"</span>");
}]); |
When I try to run ngtemplates with that file it throws this error to the console.
After running it again with the --force flag. I get the same error but it does seem to compile fine at a quick glance. Here is the output.
Their compiled templates work great. However my current project requires me to edit their default templates so I'm setting up a workflow to do so. At this time I'm not actually using the rating directive so I can remove it and keep working. But it does seem somewhat likely that I or someone else would be using greater than or less than symbols in templates. I also just checked and I am using version 0.5.7. Let me know if I can do anything to help. |
@constellates Thanks for this! I'd be surprised if I can't track it down now... |
I just created a test case for this, and I didn't see the issue. Dollars to donutes says it's html min as usual :) Can you post the relevant part of your // Gruntfile.js
ngtemplates: {
rating: {
src: 'test/fixtures/rating.html',
dest: 'tmp/rating.js',
},
} // tmp/rating.js
angular.module('rating').run(['$templateCache', function($templateCache) {
'use strict';
$templateCache.put('test/fixtures/rating.html',
"<span ng-mouseleave=\"reset()\" ng-keydown=\"onKeydown($event)\" tabindex=\"0\" role=\"slider\" aria-valuemin=\"0\" aria-valuemax=\"{{range.length}}\" aria-valuenow=\"{{value}}\">\n" +
" <i ng-repeat=\"r in range track by $index\" ng-mouseenter=\"enter($index + 1)\" ng-click=\"rate($index + 1)\" class=\"glyphicon\" ng-class=\"$index < value && (r.stateOn || 'glyphicon-star') || (r.stateOff || 'glyphicon-star-empty')\">\n" +
" <span class=\"sr-only\">({{ $index < value ? '*' : ' ' }})</span>\n" +
" </i>\n" +
"</span>\n"
);
}]); |
Here you go.
Yea I tried tracing where the error originated and it looks like it came from the html-minifier library. |
TBH, that library has been the cause of many, many issues =/ #99 #98 #97 #91 #82 My recommendation would be to just try Unless there's something I can do (switch libs, update html-minifier, etc.) I'm not sure what to do... :( |
I'm trying to use grunt-angular-templates in conjunction with angular ui-bootstrap's templates. This default ratings template causes it to throw a parse error https://github.com/angular-ui/bootstrap/blob/master/template/rating/rating.html . The less than sign on line 3 is the culprit. Considering angular allows people to evaluate javascript in their templates is there a way to allow things like this? I tried toggling various settings that seemed potentially related and wasn't able to get it to work.
The text was updated successfully, but these errors were encountered: