Merge pull request #509 from sloria/fix-component-docs
Component docs fixes
This commit is contained in:
commit
e509af1105
1 changed files with 31 additions and 31 deletions
|
|
@ -61,12 +61,12 @@ Modules can have arguments "preloaded" into them. Calling `m.module` without a D
|
|||
```javascript
|
||||
//declare a component
|
||||
var MyModule = {}
|
||||
MyModule.controller = function(options, extras) {
|
||||
MyModule.controller = function(args, extras) {
|
||||
this.greeting = "Hello"
|
||||
console.log(options.name, extras)
|
||||
console.log(args.name, extras)
|
||||
}
|
||||
MyModule.view = function(ctrl, options, extras) {
|
||||
return m("h1", ctrl.greeting + " " + options.name + " " + extras)
|
||||
MyModule.view = function(ctrl, args, extras) {
|
||||
return m("h1", ctrl.greeting + " " + args.name + " " + extras)
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -148,11 +148,11 @@ var TemperatureConverter = {
|
|||
return (value 9 / 5 * (v - 273.15)) + 32
|
||||
}
|
||||
},
|
||||
view: function(ctrl, options) {
|
||||
view: function(ctrl, args) {
|
||||
return m('div', [
|
||||
"celsius:", ctrl.kelvinToCelsius(options.value),
|
||||
"celsius:", ctrl.kelvinToCelsius(args.value),
|
||||
m("br"),
|
||||
"fahrenheit:", ctrl.kelvinToFahrenheit(options.value),
|
||||
"fahrenheit:", ctrl.kelvinToFahrenheit(args.value),
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
|
@ -329,7 +329,7 @@ var ContactsWidget = {
|
|||
view: function(ctrl) {
|
||||
return [
|
||||
m.module(ContactForm, {onsave: ctrl.save}),
|
||||
m.module(ContactList, {contacts: contacts})
|
||||
m.module(ContactList, {contacts: ctrl.contacts})
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -408,7 +408,7 @@ var ContactForm = {
|
|||
Contact.save(contact)
|
||||
}
|
||||
},
|
||||
view: function() {
|
||||
view: function(ctrl) {
|
||||
var contact = ctrl.contact()
|
||||
|
||||
return m("form", [
|
||||
|
|
@ -494,7 +494,7 @@ var ContactForm = {
|
|||
Contact.save(contact).then(Observable.trigger)
|
||||
}
|
||||
},
|
||||
view: function() {
|
||||
view: function(ctrl) {
|
||||
var contact = ctrl.contact()
|
||||
|
||||
return m("form", [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue