Looking to display embedded video and audio from various platforms such as Youtube, Soundcloud, and others. I have a couple of ideas on how to approach this and am open to exploring different options.
One option is to store the full embed code in the Mongo DB for each item, using
{{ item.embedCode }}
in Angular to retrieve it. While this method is straightforward, it may become cumbersome if the embed codes need to be updated frequently.Another approach is to handle the logic for retrieving the embed code within the Angular code itself, with conditional statements like
. However, this could lead to increased app size and longer load times, especially with a large number of embed types.if ($scope.embedItem.type == 'youtube') { $scope.embedItem.embedCode = "YOUTUBE-EMBED-CODE-HERE" }
I'm interested in exploring other potential methods for embedding content from different sources.