angularjs - Directive custom control -



angularjs - Directive custom control -

i trying create directive custom video control. loading html file templateurl of directive. problem when there more 1 controls, have same src file set of them , sharing state of video well. when pause control, pauses video beingness played on 1st control. here directive template using:

dapp.directive('myvideocontrol', function(){ homecoming { scope: { cameraurl: '=vccameraurl' }, restrict: 'e', templateurl: './../../js/directives/myvideocontrol.html', link: function (scope, element, attrs) { scope.playvideo = function(){ var v = document.getelementsbytagname("video")[0]; v.play(); } scope.pausevideo = function(){ var v = document.getelementsbytagname("video")[0]; v.pause(); } } } });

will appreaciate if can point out if doing wrong here.

thanks.

it looks problem having looking element tag name. basically, every element in dom tag <video> going effected utilize of directive.

the thought directives, provide direct access element directive assigned. in case element within link function parameters. need reference individual associated elements this:

var v = element[0]; v.play();

if have assigned directive on parent element, , want children, utilize find() jqlite function on directive element:

var v = element.find('video')[0]; v.play();

angularjs custom-controls directive

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -