clarify controller in guide
This commit is contained in:
parent
7cb6982e57
commit
16e6f6fdd5
3 changed files with 5 additions and 2 deletions
|
|
@ -130,7 +130,8 @@ todo.controller = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}</code></pre>
|
}</code></pre>
|
||||||
<p>The code above should hopefully be self-explanatory. You can use the controller like this:</p>
|
<p>The code above defines a controller class. It has three members: <code>list</code>, which is simply an array, <code>description</code>, which is an <code>m.prop</code> getter-setter function with an empty string as the initial value, and <code>add</code>, which is a method that adds a new Todo instance to <code>list</code> if an input description getter-setter is not an empty string. Later in this guide, we'll pass the <code>description</code> property as the parameter to this function. I'll explain why we're passing it as an argument when we get there.</p>
|
||||||
|
<p>You can use the controller like this:</p>
|
||||||
<pre><code class="lang-javascript">var ctrl = new todo.controller();
|
<pre><code class="lang-javascript">var ctrl = new todo.controller();
|
||||||
|
|
||||||
ctrl.description(); //[empty string]
|
ctrl.description(); //[empty string]
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -127,7 +127,9 @@ todo.controller = function() {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The code above should hopefully be self-explanatory. You can use the controller like this:
|
The code above defines a controller class. It has three members: `list`, which is simply an array, `description`, which is an `m.prop` getter-setter function with an empty string as the initial value, and `add`, which is a method that adds a new Todo instance to `list` if an input description getter-setter is not an empty string. Later in this guide, we'll pass the `description` property as the parameter to this function. I'll explain why we're passing it as an argument when we get there.
|
||||||
|
|
||||||
|
You can use the controller like this:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var ctrl = new todo.controller();
|
var ctrl = new todo.controller();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue