Created
November 1, 2012 10:42
-
-
Save kevinansfield/3992996 to your computer and use it in GitHub Desktop.
Ember view - unable to access controller?
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
| Chapters.EditChapterView = Ember.View.extend | |
| templateName: 'chapters/edit' | |
| tagName: 'form' | |
| classNames: 'form-horizontal' | |
| didInsertElement: -> | |
| @_super() | |
| @$('input:first').focus() | |
| submit: (event) -> | |
| event.preventDefault() | |
| @get('controller').updateRecord() | |
| imagePicker: Ember.View.extend | |
| tagName: 'div' | |
| template: Ember.Handlebars.compile " | |
| <input type=\"hidden\" {{bindAttr value=\"parentView.thumbnail_url\"}} /> | |
| <a href=\"#\" class=\"btn\">Pick File</a> | |
| <span>{{parentView.thumbnail_url}}</span> | |
| " | |
| filepicker_options: | |
| mimetype: 'image/*' | |
| services: ['COMPUTER','FACEBOOK','INSTAGRAM','URL','WEBCAM'] | |
| openTo: 'COMPUTER' | |
| click: (event) -> | |
| event.preventDefault() | |
| filepicker.pick(@filepicker_options, @filepickerSuccess, @filepickerError) | |
| filepickerSuccess: (file) -> | |
| # @get('controller').setImage(file.url) | |
| Chapters.router.editChapterController.setImage(file.url) | |
| filepickerError: (error) -> | |
| console.log error.toString() |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated to access the controller instance directly through the router, is this standard practice?