0

I am using AngularJs and jQuery. I have a div element on my page which encompasses other div elements that represent tabs for school subjects. Only four subjects are to be displayed at a time. There are arrows to either side of this parent div which when pressed will change the style of the parent div so that its left property will shift 100% in the appropriate direction. This shift reveals the next 4 (or fewer) subjects. The arrows have the ng-click directive as an attribute which is tied to a function that uses the .css() jQuery method to accomplish this style change. The issue I'm having is that the function won't fire initially. However, if I refresh the page all functionality works just fine. What could be happening after the refresh which would allow everything to work properly?

justcant
  • 109
  • 1
  • 10
  • [Don't use jQuery with AngularJS](https://stackoverflow.com/questions/14994391/thinking-in-angularjs-if-i-have-a-jquery-background). But if you do, wrap jQuery code with `$timeout` because it is not part of AngularJS digest cycle. You can call it manually with `$scope.$apply()` too, add that into your function that you call with `ng-click` to re-render the page and apply your changes. DOM manipulations are for _directives_, which use jQLite – Aleksey Solovey Mar 05 '18 at 16:28
  • This makes sense. Thank you! – justcant Mar 05 '18 at 16:55

0 Answers0