Angular ngHint - expressions don't support hyphens

I noticed this on 3.15-3.16, all of a sudden I started getting errors for expressions with hyphens (minus signs)

Source: <div ng-click="Landing.goSlide(-1,4)"></div>

Mistake: Error: [$parse:ueoe] Unexpected end of expression: Landing.goSlide( {link…} at REGEX_STRING_REGEXP

When I remove -

to 1, it works again, but I don't understand why that broke in the first place.

Update:

Found the culprit ngHint I'm not sure why angular is compiled with ngHint and I can't seem to find how to remove ngHint. Any hints?

+3


source to share


1 answer


Disabled if you have AngularJS Batarang extension enabled, it defaults to ng-hint enabled and it will choke on any expressions containing hyphens (and any others that will be delimited in regex)

If anyone is wondering, this is where it breaks down.



var getFunctionNames = function(str) {
    if (typeof str !== 'string') {
        return [];
    }
    var results = str.replace(/\s+/g, '').split(/[\+\-\/\|\<\>\^=&!%~;]/g).map(function(x) {
        if (isNaN(+x)) {
            if (x.match(/\w+\(.*\)$/)){
                return x.substr(0, x.indexOf('('));
            }
            return x;
        }
    }).filter(function(x){
        return x;
    });
    return results;
};

      

0


source







All Articles