I am looking for a way to retrieve the domain name from my video URL: {{video.url}}
The URL {{video.url}} contains various links such as:
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 want to extract "domain1," "domain2," "domain3," and so on, in order to create an image name within my component.ts file:
return'https://mywebsite.com/img/'+domain+'.png';
The "/img/" directory will contain numerous images with names like youtube.png, google.png, and more.
In my angular component.html file, I intend to include:
<div class="video" *ngFor="let video of mediaItem.videos">
<img [src]="getIcon">
</div>
Now, my question is what code do I need to use in my component.ts file?