Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Sproutcore is based on the model-view-controller paradigm, moreover it uses a rather conservative strict version of mvc. Your model should only contain the real values of a certain domain object. Hence, you shoudn't place your comment and placeholder strings within your model-object.</p> <p>Instead use your controller to bind to your model object as well as to all additional properties you want to discouple from your view. A typical controller setup might look as follows</p> <pre><code>YourApp.userController = SC.ObjectController.extends({ user: SC.User.create({ ... }), // Create a new user or load one from the store firstNamePlaceholder: 'First name', firstNameComment: 'Enter your first name', ... }); </code></pre> <p>It might make sense to combine the additional properties within a controller in one or more objects defined inside the controller to do some grouping, e.g.</p> <pre><code>YourApp.userController = SC.ObjectController.extends({ user: SC.User.create(), placeholder: SC.Object.create({ firstName: 'First name', lastName: 'Last name', }), comment: SC.Object.create({ firstName: 'Enter your first name', lastName: 'Enter your last name' }) }); </code></pre> <p>This might lead to a cleaner structure in your views later on.</p> <p>To put this in a nutshell, think of your model objects as traditional domain objects without class parameters use only parameters which are (potentially) unique to each instance of your domain object. Everything else goes into your controller layer. Make sure your views stay as dump as possible and only include bindings to all required application states.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload