angularjs - How to access to the current element with ng-style -


i'd access current element css properties when use ng-style

since following element:

<div ng-style="changewidth()"> 

get access css properties

$scope.changewidth = function(element) {     return {        width: element.width() / 2     } }; 

someone knows best way achieve that?

use directives:

.directive("getstyle",function(){   return{     link:function(scope,element){       element[0].style.border = "5px dotted #090";     }           }       }); 

example: http://plnkr.co/edit/izorei?p=preview

one more (directive-scope interaction): http://plnkr.co/edit/ul7n1j?p=preview


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -