My slider wont come up on first time navigation of the page. However when I hard refresh the page then it comes up and also if I replace the
The event handler attached with jQuery(window).load
will run when the page is fully loaded. However, ng-view
hasn't loaded your view yet, which means <div class="flexslider">
doesn't exist.
Move the initialization into a directive:
myApp.directive('flexslider', function () {
return {
link: function (scope, element, attrs) {
element.flexslider({
animation: "slide"
});
}
}
});
And use like this:
<div class="flexslider" flexslider>
Demo: http://plnkr.co/edit/aVC9fnRhMkKw3xfpm4No?p=preview