I've made a Web App using Angular, jQuery and Isotope.js. here is the relevant code in my view template :
<head>
<script type="text/javascript" src="../Scripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="../Scripts/isotope.min.js"></script>
<script type="text/javascript" src="../Scripts/trackpad-scroll-emulator/jquery.trackpad-scroll-emulator.min.js"></script>
<script type="text/javascript" src="../Scripts/angular.js"></script>
<script type="text/javascript" src="../Scripts/angular-route.min.js"></script>
</head>
<body ng-app="App">
<div id="main-container" data-ng-controller="MessageController">
<div ng-switch="moduleState">
<div ng-switch-when="messagespanel">
Messages panel here !
<nav id="activity-panels">
<ul>
<li>menu1</li>
<li>menu2</li>
</ul>
</nav>
</div>
<div ng-switch-when="settingspanel">
Settings panel here !
</div>
</div>
</div>
</body>
The fact is I've put an button which toggle the moduleState value between messagespanel and settingspanel.
When I click twice, I perfectly switch back to my messages panel view, but jQuery and isotope.js won't work again.
For instance, this will not work after a switch :
$("nav#activity-panels > ul > li").on("click", function () {
console.log("ok");
}
what is weird, it's that my scrollbar is customized by trackpad-scroll-emulator Js library, and this will keep working after. but none of my jquery and isotope code.
I've done a bit of search, and of course the ngSwitch directive decide wether or not to create a DOM piece. But if it's recreated after the first switch, my jQuery selector should recognize again my DOM elements ? Or do I have to refresh something, or reload jQuery ?
Thanks for any help,