I\'m integrating a media player in my app using the \"Video For Everybody\" generator. As the player features a fallback to flash if the browser doesn\'t support HTML5 vid
So the most generic, maintainable, configurable and reusable solution is to create a custom directive that will handle it for you.
Look at this -->PLNKR<-- there is practically all you need there. You have just to weak it a little bit.
How it works: to the directive you pass the configuration object (if you need more objects just create additional attributes). The element can be in two states: ready or not. And $scope.isReady
just states if all the ingredients have been collected. If so ngSwitch
loads the videoPlayer template and since all the information is there no unwanted requests are sent.