Monthly Archives: November 2013

Angular from Scratch: Slides from AngularJS Meetup DC

Thanks to all who attended! Thanks to Leigh Frampton for organizing and to LearningObjects (and Optoro :-)) for hosting. Demo files available to clone here.

Advertisements
Tagged , , , , , ,

Migrating to Angular 1.2: Modular Routing, Animations, ng-If, et al.

Note that Angular 1.2 is not yet officially released. They’re currently at Release Candidate 3, which you can install via direct download of the ‘unstable’ release at Angularjs.org, or with:

bower install angular#1.2.0-rc.3

There’s no official migration guide available as yet. So, I’m assembling bits and pieces from my own experience and from posts by others. Bottom line: many big changes in Angular are incremental and break nothing. But other changes are pretty substantial and will require modifications of your existing code to even get your app up and running.¬† Continue reading

Angular’s ng-Show vs ng-Switch (and ng-If!): Important Differences

There’s a critical and undocumented (AFAIK) distinction between several of Angular’s directives. On the surface, ng-show/ng-hide, ng-switch and the new ng-if all produce exactly the same results: partials/DOM-fragments that appear and disappear. I used to think that ng-Show and ng-Switch were just different syntax for the same thing: convenience variations, essentially. And then, ng-If came along for Angular 1.2, which made me scratch my head and take another look.

Turns out the apparent similarities in outcome are deceptive, and mask fundamentally different implementations: ng-show & ng-hide simply toggle the visibility of an element or DOM fragment that’s already in the DOM, while ng-switch and ng-If actually detach and reattach the elements/fragments/templates from the DOM. (Note that Angular 1.0.8 and 1.2 do this in different ways. The 1.2 implementation is far preferable. Comparative implementations are linked from the relevant code below.)

This has significant implications for performance, for how you construct your CSS selectors, and much else.

I built a CodePen to demonstrate the differences between these directives, and added a separate Plunker (linked from the CodePen) to show how Angular 1.08 did ng-Switch differently than 1.2. Use your inspector to see what’s going on under the hood. I’d embed said Codepen, if only WordPress.com was a little more flexible…

Angular 1.2 CodePen

Google+ Finally Permits Cross-posts from WordPress!

I wrote previously about what a pain it is to get your WordPress blog posts over into G+, like you can easily do for Twitter, ¬†Facebook, and LinkedIn. Really, it was only semi-feasible, and didn’t work automatically. Problem solved. You can now add Google+ to your ‘Publicize’ options in the WordPress Dashboard, at least on WordPress.com.

Does anybody know: has Google at last opened up an API for this (years too late), or did WordPress just find a creative workaround?

Converting a Hybrid Mobile Project to XCode 5 & iOS7

I had just a momentary lapse of reason the other day: after weeks of holding off on upgrading my iPad to iOS 7, I abruptly felt that I had been left behind. So, after double-checking that all our key enterprise features were supported, I made the leap. And then I went back to work.

On a project that was due the next day. And which I needed to be able to test on that iPad. Eeek.  Continue reading

Tagged , , ,