Last active
December 17, 2015 17:08
-
-
Save timanrebel/5643468 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fetch some User | |
var someUser = Alloy.createModel('User', { | |
id: '1234' | |
}); | |
someUser.fetch(); | |
// Create new Profile controller | |
var someProfile = Alloy.createController('Profile', { user: someUser }); | |
// Change model | |
someUser.set('name', 'New Name'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var args = arguments || {}; | |
/** | |
* Works, but you loose change listeners on the original model | |
*/ | |
$.user.set(args.user.attributes); | |
/** | |
* Does not work | |
*/ | |
// $.user = args.user; | |
$.profile.open(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Alloy> | |
<Model src="User" id="user" instance="true" /> | |
<Window> | |
<Label id="name" text="{$.user.name}" /> | |
</Window> | |
</Alloy> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment