Merge branch 'components' of https://github.com/pelonpelon/mithril.js into pelonpelon-components

Conflicts:
	docs/mithril.module.md
This commit is contained in:
Leo Horie 2015-03-06 17:13:47 -05:00
commit 57c199e2c6
3 changed files with 5 additions and 5 deletions

View file

@ -104,7 +104,7 @@ m.module(document, module1);
var module2 = {}; var module2 = {};
module2.controller = function() {}; module2.controller = function() {};
module1.view = function() {}; module2.view = function() {};
m.module(document, module2); // logs "unloading module 1" m.module(document, module2); // logs "unloading module 1"
``` ```

View file

@ -168,7 +168,7 @@ var log = function(value) {
} }
var users = m.request({method: "GET", url: "/user"}) var users = m.request({method: "GET", url: "/user"})
.then(log); .then(log)
.then(function(users) { .then(function(users) {
//add one more user to the response //add one more user to the response
return users.concat({name: "Jane"}) return users.concat({name: "Jane"})
@ -338,7 +338,7 @@ You can read more about the [promise exception monitor here](mithril.deferred.md
The `config` option can be used to arbitrarily configure the native XMLHttpRequest instance and to access properties that would not be accessible otherwise. The `config` option can be used to arbitrarily configure the native XMLHttpRequest instance and to access properties that would not be accessible otherwise.
The example below show how to configure a request where the server expects requests to have a `Content-Type: application/json` header The example below shows how to configure a request where the server expects requests to have a `Content-Type: application/json` header
```javascript ```javascript
var xhrConfig = function(xhr) { var xhrConfig = function(xhr) {

View file

@ -78,7 +78,7 @@ This redirects to the URL `http://server/#/dashboard/johndoe` and yields:
Above, `dashboard` is a module. It contains a `controller` and a `view` properties. When the URL matches a route, the respective module's controller is instantiated and passed as a parameter to the view. Above, `dashboard` is a module. It contains a `controller` and a `view` properties. When the URL matches a route, the respective module's controller is instantiated and passed as a parameter to the view.
In this case, since there's only route, the app redirects to the default route `"/dashboard/johndoe"`. In this case, since there's only one route, the app redirects to the default route `"/dashboard/johndoe"`.
The string `johndoe` is bound to the `:userID` parameter, which can be retrieved programmatically in the controller via `m.route.param("userID")`. The string `johndoe` is bound to the `:userID` parameter, which can be retrieved programmatically in the controller via `m.route.param("userID")`.