Skip to content

Instantly share code, notes, and snippets.

@FokkeZB
Forked from timanrebel/Profile.js
Last active December 17, 2015 18:49
Show Gist options
  • Save FokkeZB/5656268 to your computer and use it in GitHub Desktop.
Save FokkeZB/5656268 to your computer and use it in GitHub Desktop.
Another workaround
// Fetch some User
var someUser = Alloy.createModel('User', {
id: '1234'
});
someUser.fetch();
// Alloy expects this property
someUser.__transform = {};
var someProfile = Alloy.createController('Profile', { $model: someUser });
someUser.set('name', 'New Name');
// Alloy doesn't listen to changes, so we do:
$model.on('change', function (model) {
$.name.text = model.get('name');
});
<Alloy>
<Window>
<Label id="name" text="{name}" />
</Window>
</Alloy>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment