explorers' club

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


Leave a comment

AngularJS: See if Angular is Using JQuery or JQLite

It’s as easy as:

//true if angular is using jQuery, false if using jqLite
angular.element === window.jQuery
Advertisements


Leave a comment

Note to Self: Angular Directive Communication (via Isolate Scope) to Parent Scope with Object Parameter

Given the following HTML

How do we communicate the value known only to the directive but passing back to the controller’s scope?  Like so:


Leave a comment

Angular: ngBackspace Directive

I’m not entirely sure why certain keys on a keyboard fire keydown but not keyup, some fire keypress while others don’t and then in the backspace’s case, it only fires on keyup.  Nevertheless I found myself in need of triggering action on backspace.

[gist https://gist.github.com/jusopi/b89fb2cd31a2da8d0fed]


Leave a comment

Notes on Angular 2014.06.10

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