Saturday, 4 March 2017

Angular Notes


Services
  • You can use services to organize and share code across your app.
  • You can also register services via the $provide service inside of a module's config function
This technique is often used in unit tests to mock out a service's dependencies. How? I don't know.

Scope

  • Nested scopes are either "child scopes" or "isolate scopes". A "child scope" (prototypically) inherits properties from its parent scope. An "isolate scope" does not.
  • The scope is the single source-of-truth for all things view related.
  • Each AngularJS application has exactly one root scope, but may have any number of child scopes.
  • The location where the root scope is attached to the DOM is defined by the location of ng-app directive. The other way around is true as well.
  • You can check the scope of any element using the dubugger, although it is only available when the setting $compileProvider.debugInfoEnabled() is true (which is the default). Also it should be OFF in production release.



No comments:

Post a Comment