Custom HTML5 video player controls with AngularJS

后端 未结 4 1548
死守一世寂寞
死守一世寂寞 2021-02-04 18:49

I\'m new with AngularJS. I must create customs controls for a video player (HTML5 ). Basically, I would use getElementById(\'myvideotag\')

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-04 19:19

    How about this:

    In your HTML, set ng-click="video($event)" (don't forget the $event argument), which calls the following function:

    $scope.video = function(e) {
        var videoElements = angular.element(e.srcElement);
        videoElements[0].pause();
    }
    

    I believe this is the simplest method.

    Documentation for angular.element

    Also, this might help you get used to Angular: How do I “think in AngularJS/EmberJS(or other client MVC framework)” if I have a jQuery background?

提交回复
热议问题