Angular Arghlist

When I’m learning a new language/framework/whatever, I keep an “arghfile” of gotchas (sticking points, not necessarily bugs) that caught me while developing so that I can document and/or fix them later. Here are a few from my time learning AngularJS:

  • using repeated variables on the repeated element with ng-repeat doesn’t work: <li ng-repeat="file in files" title="{{ file.title }}"></li> doesn’t work (I think this has been fixed in a subsequent release)
  • requiring a parent controller doesn’t work out-of-box if the parent directive loads a template file
  • ng-keydown only works with 1.1.5+ (documentation has been versioned since then)
  • attaching events to child elements from parent directive (may not be a good idea anyway)
  • directive element can’t be self-closing if you use more than one in a row
  • transcluded content is a sibling of its container
  • Promise then doesn’t resolve until $scope.$apply
  • ‘foo’ is the name of a provider’s injected service. ‘fooProvider’ is how you get the configuration object
  • t.value as for t in account_types for select with an object as a model