Break on a change of variable value

You don’t even need an IDE – you can use “Object.watch()”: Object.Watch Tutorial If you use any one debugger, I’d strongly recommend Firebug. For all your Javascript, HTML and CSS needs :-): http://getfirebug.com/javascript =========================================================== Update for 2019: Object.Watch is Ancient History. Uncoincidentally, it’s unavailable in most contemporary browsers. My personal favorite JS debugging tool these … Read more

AngularJS $watch window resize inside directive

You shouldn’t need a $watch. Just bind to resize event on window: DEMO ‘use strict’; var app = angular.module(‘plunker’, []); app.directive(‘myDirective’, [‘$window’, function ($window) { return { link: link, restrict: ‘E’, template: ‘<div>window size: {{width}}px</div>’ }; function link(scope, element, attrs){ scope.width = $window.innerWidth; angular.element($window).bind(‘resize’, function(){ scope.width = $window.innerWidth; // manuall $digest required as resize event … Read more