AngularJS: ng-src behavior on non-standard attributes?

前端 未结 4 1528
温柔的废话
温柔的废话 2021-02-13 03:17

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

4条回答
  •  萌比男神i
    2021-02-13 03:32

    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.

提交回复
热议问题