I'm using the ngInclude
directive to load HTML fragments. Now I'm looking for the best way to pass a dynamic URL. I know I can create the URL with string concatenation:
<ng-include src="'/foo/' + fooId + '/bar/' + barId + '/baz/' + bazId"></ng-include>
In my eyes this is a bit ugly.
ngHref
and ngSrc
for example, accept URLs containing {{}}
markup. IMHO this syntax is much cleaner:
<img ng-src="/foo/{{fooId}}/bar/{{barId}}/baz/{{bazId}}"/>
<a ng-href="/foo/{{fooId}}/bar/{{barId}}/baz/{{bazId}}"/>
Is there a better way to pass dynamic URLs to ngInclude?