Below is a snippet of my code:
<body>
<div class="body" ng-view></div>
<div class="footer" ng-view="footer"></div>
</body>
The following HTML is being added to the unnamed view in the code snippet above:
<div>
<div class="myClass"></div>
<div class="myClass"></div>
<div class="myClass"></div>
</div>
The original code with that structure works perfect as expected. The problem now comes when I try to select .myClass via a JQuery. The reason I am using JQuery to select that class is because I want to use the element containing that class with Scroll Magic as follows:
var controller = new ScrollMagic.Controller();
jq(".myClass").each(function() {
new ScrollMagic.Scene({
triggerElement: this,
duration: '50%'
})
.setPin(this)
.addTo(controller);
});
After inspecting my code I realized the the elements within the body tag can be picked up by JQuery, but those that are rendered in the views are not. My guess is that this issue can be solved with late binding techniques if not mistaken.
My Questions
- Am I correct in my assumption that late binding can solve this issue?
- How can I structure the code above to be able to pick the elements within my ng-views?
- Are there better ways I can accomplish the desired task above without JQuery?
- If late binding is my solution, how can I perform late binding on an each() statement?