I want to extract the domain name from my - {{video.url}}
The {{video.url}} contains different links like this:
https://domain1.com/123/abc
https://www.domain2.com/123/abc
http://www.domain3.com/123/abc
http://domain4.com/123/abc
https://www.domain5.com?123&abc
https://www.domain6.com/123/abc.html
I need the "domain1" "domain2" "domain3" ... and use this to create an image name under my component.ts:
return'https://mywebsite.com/img/'+domain+'.png';
The folder "/img/" will have many images named, youtube.png - google.png ...
On my angular component.html I want to add
<div class="video" *ngFor="let video of mediaItem.videos">
<img [src]="getIcon">
</div>
But what code should I use in component.ts ???