Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From the Ember side, there's no reason to use Ember Data, because Ember works fine without it. But Ember's infrastructure relies heavily on the API provided by <a href="http://emberjs.com/api/classes/Ember.Observable.html" rel="nofollow"><code>Ember.Observable</code></a>, which is available to all subclasses of <a href="http://emberjs.com/api/classes/Ember.Object.html" rel="nofollow"><code>Ember.Object</code></a>. Similarly, JavaScript arrays will support more Ember features if you use <a href="http://emberjs.com/api/classes/Ember.Array.html" rel="nofollow"><code>Ember.Array</code></a> and <a href="http://emberjs.com/api/classes/Ember.MutableArray.html" rel="nofollow"><code>Ember.MutableArray</code></a>, although this will happen automatically unless you <a href="http://emberjs.com/guides/configuring-ember/disabling-prototype-extensions/" rel="nofollow">disable <code>Ember.EXTEND_PROTOTYPES</code></a>.</p> <p>So one very reasonable approach would be to port your existing model classes to <code>Ember.Object</code>. That would require, among other things, using <code>get</code> and <code>set</code> to access properties. If you do this, then your objects will be first class Ember citizens, and you'll have access to all the neat features of Ember, including automatic view updates and data bindings.</p> <p>Here's what <code>Ember.Object</code> looks like, and how it integrates with the rest of Ember:</p> <pre><code>MyApp.Person = Ember.Object.extend({ firstName: null, lastName: null, init: function () { // You can put more initialization code here. }, // Compute fullName based on firstName and lastName. // This will automatically propagate updates when // firstName or lastName changes. fullName: function () { return this.get("firstName") + " " + this.get("lastName"); }.property("firstName", "lastName") }); var person = MyApp.Person.create({ firstName: "Jane", lastName: "Doe" }) </code></pre> <p>Then, in an Ember view, you could write something like:</p> <pre><code>&lt;p&gt;{{person.fullName}}&lt;/p&gt; </code></pre> <p>…and the view would automatically updated whenever <code>firstName</code> or <code>lastName</code> changed. Similarly, you could edit <code>firstName</code> using the following code:</p> <pre><code>{{view Ember.TextField valueBinding="person.firstName"}} </code></pre> <p>In this example, changes to the text field will be automatically propagated back to the underlying object. (Though you can get clever and build a text field that only propagates changes when the user is done editing.)</p> <p>If you need to pass property updates from Ember to QT, see the <a href="http://emberjs.com/guides/object-model/computed-properties/" rel="nofollow">guide to building getters and setters with computed properties</a> or use <a href="http://emberjs.com/guides/object-model/observers/" rel="nofollow">observers</a>. A lot depends on exactly how you're exposing your C++ APIs via your JavaScript bridge. But as long as you can tie into <code>Ember.Observable</code> somehow, you'll have full access to all of Ember's features.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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