Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

ngSanitize linky filter throws error if text is truthy but not a string #13547

Closed
@CloudNiner

Description

@CloudNiner

http://jsfiddle.net/an710xcL/16/

Stacktrace thrown in that fiddle:

TypeError: l.match is not a function
    at https://code.angularjs.org/1.4.8/angular-sanitize.min.js:15:169
    at fn (eval at <anonymous> (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.js:13365:15), <anonymous>:4:159)
    at regularInterceptedExpression (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.js:14446:55)
    at Object.expressionInputWatch [as get] (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.js:14347:26)
    at Scope.$digest (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.js:15888:40)
    at Scope.$apply (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.js:16160:24)
    at bootstrapApply (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.js:1679:15)
    at Object.invoke (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.js:4523:17)
    at doBootstrap (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.js:1677:14)
    at bootstrap (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.js:1697:12)

If looping an array or dictionary and linkying each value, it would be nice if mixed types didn't fail.

A simple workaround for now is to cast before passing to linky, e.g:

var text = 42;
$filter('linky')(''+text);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions