Skip to content
adnan-i edited this page Mar 20, 2013 · 5 revisions

Editors: put 2 spaces at the end of a question to create a <br>

  1. Where can I find good learning resources?
    Learning Resources

  2. How do I access the DOM from a controller?
    DO NOT perform DOM selection/traversal from the controller. The HTML hasn't rendered yet. Look up 'directives'.

  3. Why does angular say my controllers/directives/etc are missing?
    Calling angular.module('myApp', []) will ALWAYS create a new module (and wipe out your existing one). Instead, make sure to call angular.module('myApp') with only 1 parameter to refer to an already created module.

  4. How to render unescaped data?
    You will probably want ng-bind-html-unsafe sooner or later.

  5. How can I watch when an array/object/ngResource query is modified?
    $scope.$watch has a third parameter to monitor changes by value (and not by reference).

  6. Don't try to serialize the form or collect the input values manually. Just slap ng-model="data.myField" onto every form input you use and then take a gander at $scope.data when you finally need it.

  7. Always have a '.' in your ng-models. Misko best practice.

  8. $rootScope is essentially where you put ng-app. You can inject $rootScope into your bootstrap or services to add stuff that should be accessible on all scopes.

  9. The difference between module().factory() and module().service().

  10. Prevent Flash Of Unstyled Content (FOUC) (and curly braces) by mixing ng-bind with ng-cloak.

  11. Nested Routes / Views? Maybe...

  12. You can always do <script id="some/partial.html" type="text/ng-template"> and angular will use it instead!

  13. Escape the port in $resource('example.com\\:8080')

  14. Angular watches the input event, not the 'change' event.

  15. Don't use jQuery to toggle crap. Just use a lot of variable flags inline: <a ng-click="flags.open=!flags.open">...<div ng-class="{active:flags.open}">

  16. If you're on Google Chrome, install the Batarang extension, inspect a DOM element, and type $scope in the console.

  17. Checkout AngularUI for an awesome collection of directives (and even BETTER example code).

  18. For IE v8.0 or earlier you may want to read this and use this.

  19. If you want to get rid of the # in your routes, search the docs for html5mode.

  20. You should try using the AngularUI Passthru Directive (uiJq) before trying to roll your own jQuery plugin wrapper directive.

  21. If you change newVal inside your $scope.$watch it could fire again (recursively?).

  22. You should ONLY use $scope.$apply in non-angular events/callbacks. It usually doesn't belong anywhere else.

  1. overview
  2. fork project
  3. install git client
  4. clone project
  5. install node.js
  6. run node console
  7. install npm
  8. install grunt
  9. build project
  10. start webserver
  11. translate angular.js
Clone this wiki locally