explorers' club

explorations in dev, science, sci-fi, games, and other fun stuff!

Notes on Angular 2014.06.10

Leave a comment

I was trying to draw parallels in AngularJS and something like RobotLegs (which is my preferred MVC framework when building Flex/Flash applications).  Here are some interesting findings:

$scope.$root == $rootScope

There is no need to inject both $scope & $rootScope in a controller definition.  $scope is enough.

$scope.$emit

Angular has a built in event dispatching mechanism outside of the normal event dispatcher paradigm we see in JavaScript and ActionScript.  For those ActionScript developers, $emit is the equivalent of dispatching a bubbling event that bubbles up through the display list.  However in this case, Angular is bubbling up the $scope hierarchy.  This bubbles up towards the $rootScope

$scope.$broadcast

This is the opposite of bubbling up an event.  In this case, it’s drilling down descendent $scopes in the $scope hierarchy.

putting it all together

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s