In Angular app I have <base href="/foo/bar/">
and $locationProvider.html5Mode(true);
I want to create some list:
<div ng-repeat="item in vm.items">
<a ng-href="{{item}}" target="_blank">{{item}}</a>
<a ng-href="{{item}}" download>{{item}}</a>
</div>
My items can look like this: ['example1.com', 'www.example2.com', 'http://www.example3.com', 'https://www.example4.com'];
For example3
and example4
it works ok.
What is the best way to fix it for:
example1.com
- now it goes tohttp://localhost/foo/bar/example1.com
www.example2.com
- now it goes tohttp://localhost/foo/bar/www.example2.com
How can I force it to use absolute url? It should work with http
, https
and with download
attribute.