0

I have a div like this:

<div class="row loginCtrl.padding(50)"></div>

My controller code goes like this:

app.controller("loginController", function(){

  this.padding = function(val){
    alert('padding-top-'+val);
  }

});

i know that padding function will be only called on a event like click etc

2
  • You should use ng-class for this Commented Jul 29, 2017 at 10:45
  • I new to angularjs. It could help me if you post an answer. Commented Jul 29, 2017 at 10:45

1 Answer 1

1

You should use ng-class for this

<div class="row" ng-class="loginCtrl.padding(50)"></div> 



app.controller("loginController", function(){

 this.padding = function(val){
    return 'padding-top-'+val;
   }

});
Sign up to request clarification or add additional context in comments.

3 Comments

hi, can you help me with this one stackoverflow.com/questions/45385280/…
excusme @texirv. may be create a demo people can help you.
Hey mine is a huge codebase not able to include all the files

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.