Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How I learned to stop worrying and love the router

How I learned to stop worrying and love the router

5 Tips on using the new router that shipped with ember v1.0.0-pre.4, presented to ember nyc meetup on 2013/01/24

Michael Grassotti

January 24, 2013
Tweet

More Decks by Michael Grassotti

Other Decks in Technology

Transcript

  1. Routes are Magic 5 # 1 ALMOST ALL BOILERPLATE GOES

    AWAY As long as you Follow The Ember naming conventions
  2. WTF Router? 8 # 2 its hard to know what’s

    going on WITHOUT LOG_TRANSITIONS = TRUE For Console.log output when the router transitions between States
  3. WHERE AM I? 9 # 3 The router will tell

    you. It sets a currentPath property on you application controller
  4. Template w.no Route? 10 # 4 Use the Handlebars {{render

    sidebar}} tag - IT WILL wrap Your template in a view/Controller Pair wit
  5. Routes ARE STATES 11 # 5 but the ROUTER is

    not a STATE MANAGER (anymore)
  6. Routes ARE STATES 12 # 5 Create Record on enter

    (via model Hook) Save: Register DidCreate CallbaCK TheN Commit DidCreate: Transition elsewhere EXIT: Rollback Unsaved Model