javascript - Retrieve css values in Angular JS directives -


I am an angular JS NewBi and I try to write some encoded directories in style button groups. I have a "restricted: 'A' Directorate in which I need to retrieve the parents' padding so that they are usable within. I also try to avoid JQuery, Angular JS looks very clean and I do not want to mess up this feeling. In essence my link function includes:

  parentScope = element.parent (). Area (); ParentScope $ Watch (parentHeight = element.parent () [0]. CSS ("padding"), function (newvalue, oldview, scope) {var parentHeight = element.parent () [0] .offsetWidth, parentPadding = newValue;} < / Code> 

I am getting an undefined error. What is the correct way to access CSS values ​​in the instructions?

$ should be given a name for the watch circle (the string) or the function (). If this is the name of the member then its response to the change If this task is to respond to changes in your return value, the result of the assigned assignment is assigned, so you are definitely giving the value of the padding at a specific time to see, while the name of the member or Function should be given. You should instead give a function that gives the value of padding, like this:

  parentScope. $ Watch (function () {return element.parent () [0] .css ("padding");}, function (newValue, oldValue, scope) {Var Parents Right = element.parent () [0] .offsetWidt h, parentpadding = new value; });  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -