How to access to the current element with ng-style

后端 未结 1 689
不思量自难忘°
不思量自难忘° 2021-01-11 10:47

I\'d like to get access to the current element css properties when I use ng-style

Since the following element:

1条回答
  •  走了就别回头了
    2021-01-11 11:06

    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

    0 讨论(0)
提交回复
热议问题