Sup, AngularJS?
Glen Maddern
@glenmaddern
glen@goodfil.ms
«
{{activeSlide + 1}} / {{totalSlides}}
»
What is AngularJS?
- It's The Future™, like Rails was back in '05 (imo)
- Just went 1.0.0 (then quickly 1.0.1, sound familiar?)
- Started in 09, run by three Googlers, but not very Googly
Simplest example
Live updating
MVC? MVVM? Wat?
- Angular calls itself MVC but I don't buy it.
- Controllers, Directives, Services
- Plain-old-JS objects for models instead of a (potentially fat) Model layer.
- Controllers scoped to DOM
- Directives extend HTML
- Services are your batarangs. Or your bat-utility-belt. Whatever. Anyway they're useful.
Scope
- The communication between a Controller and the DOM
- The simple example before was defining 'bro' on Angular's rootScope
- Let's define our own:
Controller + Scope
Collections
Collections
Data!
Data!
Objection!
- But, but, putting JS in HTML is bad!
- Oh wait, no it isn't.
-
Doing this a hundred times is bad:
- Ember's doing a similar thing (with handlebars extension), and hipsters love it.
HTML is a DSL. Make it pro.
- New tags! New attributes! New all the things!
- Defined using Directives
- Keeps the DOM out of your controllers
-
Invoked how you like:
My First Directive
Live iframe
Live iframe
Go forth!
- No time to talk about routing/services/etc
- Go to http://angularjs.org/
- Watch the videos!
- Hit me up on twitter!
- This presentation (which is an Angular app, of course) is available at https://github.com/geelen/angular_presentation