I'm setting an attribute on my directive and I can access the value from within the controller but I can't access it within my angular.element which is in the controller:
controller: ['$scope', '$window', function($scope, $window) {
console.log('my value is logged: ' + $scope.myvalue)
angular.element($window).bind("scroll", function() {
console.log('my value is not logged: ' + $scope.myvalue)
}
}],
I want to append elements to the dom only if $scope.myvalue
is true and when a scroll point has been reached on the page.
How would I do this?
console.log
using$scope.$apply
? – mzulch Jan 23 '16 at 2:22$scope.$apply
worked:$scope.$apply(function() { $scope.header; $scope.footer; });
– user1532669 Jan 23 '16 at 17:02$scope.$apply
answer:) – user1532669 Jan 23 '16 at 17:03