angular.module("app").directive('stopWatchersIf', function(){
    return {
        link: function (scope, element, attrs) {

            scope.$watch(attrs.stopWatchersIf, function (newVal) {
                if (newVal === undefined) {
                    return;
                }
                if (newVal) {
                    toggleChildrenWatchers(element, true);
                } else {
                    toggleChildrenWatchers(element, false);
                }
            });
        }
    }
});