I\'ve been setting up a jquery plugin MixItUp with AngularJS and although I can successfully initiate the container during one of my partial views with NgRoute, once I move
I spent several hours and finally the solution is here....
if ($('#grid').mixItUp('isLoaded')) {
$('#grid').mixItUp('destroy');
$('#grid').mixItUp();
} else {
$('#grid').mixItUp();
}
Here's the full directive code..
'use strict';
angular.module('rjApp')
.directive('mixitup',function($timeout,$compile){
var linker = function(scope,element,attr) {
scope.$watch('entities', function(newVal, oldVal){
$timeout(function(){
if ($('#grid').mixItUp('isLoaded')) {
$('#grid').mixItUp('destroy');
$('#grid').mixItUp();
} else {
$('#grid').mixItUp();
}
},10);
},true);
};
return {
link: linker,
scope:{entities:'='}
}
})