How i learned to stop worrying and love the router

Preview:

DESCRIPTION

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

Citation preview

How I learned to stop worrying and love the Router

1

5 Tips2

Routes are Magic

3

# 1

Routes are Magic

4

# 1

IT ALL Starts with Templates

Routes are Magic

5

# 1

ALMOST ALL BOILERPLATE GOES AWAY As long as you Follow The

Ember naming conventions

Routes are Magic

6

# 1

With Router v1: 282 loc

Routes are Magic

7

# 1

Today: 32 loc

WTF Router?

8

# 2

its hard to know what’s going on WITHOUT

LOG_TRANSITIONS = TRUEFor Console.log output when the router transitions between States

WHERE AM I?

9

# 3

The router will tell you. It sets a

currentPathproperty on you application controller

Template w.no Route?

10

# 4

Use the Handlebars

{{render sidebar}}tag - IT WILL wrap Your template in a view/Controller Pair wit

Routes ARE STATES

11

# 5

but the ROUTER is not a STATE MANAGER (anymore)

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

Questions

13

GitHub: @MIKEGRASSOTTItwitter: @mgrassotti

Recommended