Skip to content

Instantly share code, notes, and snippets.

@williscool
Created August 4, 2014 01:46
Show Gist options
  • Save williscool/f2a663a4e5c2da847d2a to your computer and use it in GitHub Desktop.
Save williscool/f2a663a4e5c2da847d2a to your computer and use it in GitHub Desktop.
ng view and routing tutorial.md
  1. do ngview
  • bower install angular-route --save
  • we use the name views for the folder in this example but you could call it whatever you want. some people like to organize their code into feature but for this examples we will just toss all views in the views folder stock rails style.
  • (only if someone ask) unfortunately you can only set one view with ngView. it gets more complicated if you want multiple
  1. intro providers
  • Providers are objects that provide (create) instances of services and expose configuration APIs that can be used to control the creation and runtime behavior of a service. In case of the $route service, the $routeProvider exposes APIs that allow you to define routes for your application.
  1. add another page
  2. add variable urls and display them in page
  • intro routeParams
  1. exersize #1 make a word appear in the template instead of a number
  2. exersize #2 like mix the directives we know (ng-repeat) and make a links of elements repeat based off of a number from a url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment