Run javascript function when ui-router state changes?

Viewed 9143

In a Angular App i am using ui-router to handle navigation etc. In a separate script file, i have a function like so;

$(function () {
  function doSomething(){
    if ($('.thisclass').length) {
      $('.thisclass').css({ 'height': someHeight });
    }
  }
});

My problem is, that whenever the state changes, i want to run the above function. But as it is not part af any Angular function, i get an error when i reference it, as i cannot find it.

What should i be doing, instead of the above?

3 Answers
Related