Is there anyway to pass a string through ng-href
and achieve the same result as if it was the value of that directive?
e.g.
{{ url | ng-href }}
So that way the filter or pipe sanitizes any values and conforms the proper url scheme.
Is there anyway to pass a string through ng-href
and achieve the same result as if it was the value of that directive?
e.g.
{{ url | ng-href }}
So that way the filter or pipe sanitizes any values and conforms the proper url scheme.
Not quite clear what you're trying to achieve. But if you wanted to be able to convert a string in the model into the href
attribute on a <a>
tag - you may use smth like this $sce.trustAsUrl
(angular site docs)
SCE assists in writing code in a way that (a) is secure by default and (b) makes auditing for security vulnerabilities such as XSS, clickjacking, etc. a lot easier.