0

I am quite new to angular js. And i have no clue where to search for a solution.

I need style settings in my controller. To more perciese i need the width of an element in my controller. I don't think jquery is the right way to go in angular js. What i want is: i want to show the width of an element as a number in another element. So what i want is doing exactly the oposite of ng-style which changes the widht to the content of the textfield.

I searched for binding a model to an element style. But i can't find anything. Am i looking in the right direction? Could someone point me in a right direction please?

1 Answer 1

1

The right direction would be to use a directive. I would suggest to create a directive that can retrieve the relevant style properties and places those on its scope:

something like this:

directive('checker', function(){
  return {
    restrict : 'A',
    scope : {
        checker : '='
    },
    link: function(scope){
        scope.checker = // set here the css properties that can be linked to a controller
    }
  }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.