AngularJS – $$postDigest vs $timeout when DOM update is needed

April 8, 2014

When you need to update the DOM once after dirty checking is over or in other words, fire a callback after the current $digest cycle completes,you can use $$postDigest or $timeout.I’ll try to explain the cons and the pros of  $$postDigest and $timeout. $$postDigest  pros:          1. Fires a callback after the current $digest cycle completes.          2. Great for updating the DOM once after dirty checking is over. cons:          1. $$ means private to Angular, the interface is not stable. usage: //runs immediately after $scope.$digest$scope.$$postDigest(function(){ console.log("post Digest"); }); * it should be noted that...
no comments

AngularJS – Why does $scope.$apply affect other scopes and how it affects performance?

March 29, 2014

as you can see from Angular’s $apply pseudo-code: function $apply(expr) { try { return $eval(expr); } catch (e) { $exceptionHandler(e); } finally { $root.$digest(); } } Internally angular does the following: $scope.$apply = $rootScope.$digest //+ some error handling and since $scope.$apply uses $rootScope, it affects all its descendants by dirty-checking EVERY data-bound objects, it’s crazy,...
one comment

AngularJS – $watch for changes in specific object property when watching an array

March 26, 2014

When deep $watch is needed on an array, but not for the entire object, you can strip off irrelevant data, this way you make the comparison much faster. Example: (solution by Karl Seamon) $scope.$watch(function($scope) { return $scope.listOfBigObjects. map(function(bigObject) { return bigObject.foo. fieldICareAbout; }); }, myHandler, true); this way you watch only what you need. Live example for watching only for "name" property: hope you’ll find this post helpful.
3 comments

Dependency Injection and Possible Future of AngularJS Presentation by Vojta Jina

January 27, 2014

A great presentation  by Vojta Jina, Senior Software Engineer in Google and a contributor to AngularJS about "Dependency Injection and Possible Future of AngularJS"  took place in ng-conf conference. A must see video and presentation about "Dependency Injection and Possible Future of AngularJS". link: Presentation document
tags: ,
no comments

Optimizing a Large AngularJS Application Presentation by Karl Seamon

A great presentation  by Karl Seamon, Senior Software Engineer in Google and a contributor to AngularJS about "Optimizing a Large Angular Application" took place in ng-conf conference. A must see video and presentation about optimizing a Large AngularJS Application. The covered topics are: A) The Problems B) Basics and Best Practices C) Diagnosing performance problems D) Improving performance within AngularJS link: Presentation Document
no comments

AngularJS – HTML5 Canvas Drag and Drop Directive Using KineticJS

January 7, 2014

Recently for one of my projects I needed to add drag and drop (DnD) functionality. After examining the native HTML5 DnD I come to conclusion that the awesome HTML5 feature still suffers from cross browser computability issues, second of all the lack of mobile touch support really pissed me off. On the other hand, Canvas has no cross browser computability issues and has a great touch support. To make a long story short, I implemented Canvas DnD functionality in AngularJS directive. We use KineticJS -an HTML5 Canvas JavaScript framework that enables high performance animations, transitions, node nesting, layering, filtering, caching, event handling...
no comments

Presentation On AngularJS Internals – $provide’s API and $injector.

December 8, 2013

A great AngularJS overview of the $provide’s API and $injector. Differences between providers, factories, services, values, constants, and decorators. This presentation was written by a good Colleague of mine and a talented Front-End Developer Yan Yankowski. http://blog.ttyed.com/2013/12/a-lecture-on-angularjs-internals-which.html
tags: ,
no comments

AngularJS – Migrating From 1.0 to 1.2 $event Object Changes

December 4, 2013

Here's a quick tip about how to avoid $event object problems when migrating AngularJS From 1.0 to 1.2 version. After migrating to 1.2 version i noticed that the $event.srcElement  object we get when working with  ng-click or some other event function, is deprecated and for some reason is not documented at all. So keep in mind and use other similar objects $event has to offer us. For example you can use $event.currentTarget it will give you the same result. Hope you'll find this quick post helpful.
no comments

Creating Facebook Canvas Apps Using The New Template And Library For ASP.NET MVC 4 Presentation

July 21, 2013

I would like to share my presentation about "Creating Facebook canvas apps using the new template and library for ASP.NET MVC 4” Presentation link: https://dl.dropboxusercontent.com/u/18850826/ FacebookGoogleSlider/index.html (open in chrome browser). Presentation on SlideShare: Creating facebook canvas apps from Alex Choroshin Hope you’ll like it
no comments