I would do one of:
Wrap the attribute in {{' and '}} :
<my-directive exclude-chars="{{' abc'}}"></my-directive>
and access the abc line, including the space, using attrs.excludeChars in the link function of the directive
link: function(scope, element, attrs) { var excludeChars = attrs.excludeChars; }
Wrap the attribute in ' and ' :
<my-directive exclude-chars="' abc'"></my-directive>
and then pass the value through $eval to go to the line containing the space:
link: function(scope, element, attrs) { var excludeChars = scope.$eval(attrs.excludeChars); }
Note: direct access to an attribute using the jQuery / jQlite attr function is always a bit not Angular friendly, supporting various directive / attribute formats with normalization and forces users to use the directive that you access through attr .
BTW: Custom HTML elements must have a private tag explicitly in the template. If you do not, I found a DOM that often uses a browser, not quite what is expected
source share