Permalink
Browse files

Merge remote-tracking branch 'origin/master'

  • Loading branch information...
2 parents 358c03f + 9cff0d5 commit 94380cc10e708e2988e42306ecd3154d6ee8d3d4 @stefanpenner stefanpenner committed Jan 23, 2013
View
@@ -55,6 +55,8 @@ Routing:
url: "routing/rendering-a-template"
- title: "Redirecting to a Different URL"
url: "routing/redirection"
+ - title: "Specifying the location API"
+ url: "routing/specifying-the-location-api"
#- title: "Dynamic Segments"
#url: "routing/dynamic-segments"
#- title: "Changing the Route"
View
@@ -92,3 +92,5 @@
image: dockyard.png
- url: http://www.montania.se/
image: montania.png
+- url: http://yourkarma.com
+ image: karma.png
@@ -35,7 +35,7 @@ number of songs that are over 30 seconds long. We can add a new computed
property called `longSongCount` to the controller:
```javascript
-App.SongsController = App.ArrayController.extend({
+App.SongsController = Ember.ArrayController.extend({
longSongCount: function() {
var longSongs = this.filter(function(song) {
return song.get('duration') > 30;
@@ -58,7 +58,7 @@ Usually, objects that represent lists implement the Enumerable interface. Some e
extensions.](/guides/configuring-ember/disabling-prototype-extensions/))
* **Ember.ArrayController** - A controller that wraps an underlying array and
adds additional functionality for the view layer.
- * **Ember.Set** - An data structure that can efficiently answer whether it
+ * **Ember.Set** - A data structure that can efficiently answer whether it
includes an object.
### API Overview
@@ -18,7 +18,7 @@ App.IndexRoute = Ember.Route.extend({
You can conditionally transition based on some other application state.
```javascript
-App.Router.map(function(match) {
+App.Router.map(function() {
this.resource('topCharts', function() {
this.route('choose', { path: '/' });
this.route('albums');
@@ -0,0 +1,37 @@
+## Specifying the location API
+
+By default the Router uses the browser's hash to load the starting state of your
+application and will keep it in sync as you move around. At present, this relies
+on a [hashchange](http://caniuse.com/hashchange) event existing in the browser.
+
+Given the following router, entering `/#/posts/new` will take you to the `posts.new`
+route.
+
+```javascript
+App.Router.map(function() {
+ this.resource('posts', function() {
+ this.route('new');
+ });
+});
+```
+
+If you want `/posts/new` to work instead, you can tell the Router use the browser's
+[history](http://caniuse.com/history) API:
+
+```js
+App.Router.reopen({
+ location: 'history'
+});
+```
+
+Finally, if you don't want the browser's URL to interact with your application
+at all, you can disable the location API entirely. This is useful for
+testing, or when you need to manage state with your Router, but temporarily
+don't want it to muck with the URL (for example when you embed your
+application in a larger page).
+
+```js
+App.Router.reopen({
+ location: 'none'
+});
+```
@@ -35,8 +35,8 @@ The `{{linkTo}}` helper takes:
* The name of a route. In this example, it would be `index`, `posts`, or
`post`.
-* If the route has a dynamic segment, a model that represents the
- segment. By default, Ember.js will replace the segment with the
+* If the route has a [dynamic segment](/guides/routing/defining-your-routes/#toc_dynamic-segments),
+ a model that represents the segment. By default, Ember.js will replace the segment with the
value of the object's `id` property.
* An optional title which will be bound to the `a` title attribute
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 94380cc

Please sign in to comment.