A request comes in. A URL comes in.
And the request is handled by router.js.coffee
and a /routes/*_route.js.coffee
file.
- The name of my example Ember App is
App
. - I'm using coffee-script, and I'm assuming it gets compiled to javascript.
/app/router.js.coffee
App.Router.map ->
@resource "jurisdictions", ->
@route 'new'
@resource "jurisdiction", path: '/jurisdictions/:id', ->
@route 'edit'
You'll have one Route for every URL you have for your site. /, /about, /signup, /login, /widget, /widget/:id.
/app/routes/agencies_route.js.coffee
App.AgenciesRoute = Ember.Route.extend
model: ->
@store.find('agency')
App.AgenciesNewRoute = Ember.Route.extend
# setupController: ->
# @store.createRecord('agency',
# name: "Default Name"
# )
renderTemplate: ->
@render into: "application"
Properties
DS.attr("string")
UI Behaviors
HTML + Handlebars