Reputation: 57
<video class="img-responsive" controls="controls" autostart="false">
<source ng-src="{{data[0].media.split(',')[0]}}" >
Your browser does not support HTML5 video.
</video>
autoplay was stop without angularjs. But i don't know how to stop autoplay using angular js coding.
Upvotes: 1
Views: 1770
Reputation: 3906
Try using directive:
.directive("pause", function() {
return {
restrict: 'EA',
scope: {
auto: '@'
}
link: function(scope, ele, attrs) {
var ele = angular.element(ele)[0];
if(scope.auto) {
ele.autoplay = true;
}
else {
ele.autoplay = false;
}
}
}
})
In html:
<video class="img-responsive" controls="controls" pause auto="false">
<source ng-src="{{data[0].media.split(',')[0]}}" >
Your browser does not support HTML5 video.
</video>
Hope this will work.
Upvotes: 1
Reputation: 122
You can check whether it has autostart attributes using angular.element('video').attr('autostart')
but I have same question. why need this? just use attributes in html
Upvotes: 0