I'm new to angular js and have been looking everywhere for an answer to why this isn't working.
I have my directive here:
.directive('carrouselPreview', function () {
return function (scope, element, attrs) {
scope.$watch(scope.carouselPreview, function () {
alert('changed');
}, true);
}
});
This watches for a change to scope.carouselPreview, which is changed through this function:
$scope.showPreview = function(ind){
$scope.carouselPreview = ind;
}
This function definitely fires and changes scope.carouselPreview - but the watch function never fires!
I realise I'm probably being dumb here but I've looked all over and it seems perfectly fine.
If anyone helps me fix this tonight I'll love you forever!