Created
July 5, 2011 10:20
-
-
Save OliverM/1064610 to your computer and use it in GitHub Desktop.
Using SC.outlet to connect objects created at runtime to other views/controllers
This file contains 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
MyApp.TestView = SC.View.extend({ | |
internalTestSet: SC.Set.create(), | |
testSet: SC.outlet('internalTestSet') | |
}); | |
MyApp.TestController = SC.ObjectController.extend({ | |
testSetBinding: 'MyApp.TestView.testSet' | |
}); | |
// at console: | |
testView = MyApp.TestView.create(); | |
testController = MyApp.TestController.create(); | |
testView.get('testSet').toString(); // returns "SC.Set<>" | |
testController.get('testSet').toString() // returns TypeError: Result of expression 'testController.get('testSet')' [undefined] is not an object. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment