I have an OutputsFormView, which should be saved on the button for click event and handler to cancel. When the Save button is clicked, it should collect all the values from the child's thoughts and send it to the controller, which then continues.
outputs.js
App.OutputsCreateRoute = Ember.Route.extend ({model: function () {App.Output.createRecord { };}, RenderTemplate: function () {return.render ('outputs / form', {controller: 'OutputsCreate'});}}); App.OutputsCreateController = Ember.Controller.extend ({save: function} {// receives empty values for the title, receiver, value console.log (model);}}); App.OutputsFormView = Ember.View.extend ({tagName: 'form', classNames: ['form', 'form-horizontal'], save: function (e) {this.get ('controller'). ('Title '), Receiver: this.get (' receiver '), value: this.get (' value ')};}, cancel: function (e) {console log (' cancellation ');}}); template
& lt; Script type = "text / x-handlebars" data-template-name = "outputs / form" & gt; {{# View app.OutputsFormView}} Lieftend Class = "Text-Right" & gt; Create a new output & lt; / Legend & gt; & Lt; Fieldset & gt; & Lt; Div class = "control-group" & gt; & Lt; Label class = "control-label" = "title" & gt; Title & lt; / Label & gt; & Lt; Div class = "control" & gt; {{See Amber. Textfield Valubiding = "View Titeley" Placeholder = "Lovely Afternoon Pizza"}} & lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "control-group" & gt; & Lt; Label class = "control-label" = "receiver" & gt; Recipient & lt; / Label & gt; & Lt; Div class = "control" & gt; {{See Amber. TextField Valubing = "see receiver" placeholder = "tower"}} For some reason I can not get the value of the child's forms and unfortunately I do not know what I forgot ...
Bodo < / P>
The solution is that each one is available in the mainbinding controller:
App.OutputsCreateController = Ember.Controller.extend ({save: function} {var output = this.get ('model'); output.set ('title', this.get ('title')); output. Set ('receiver', it.get ('receiver')); output.set ('value', this. Gadget ('value')); output save ();}}); This is better than seeing values directly out of solution but if you want to do this then you can give your view a name:
{{View ViewName = "Blubala"}} and then access it with the view of the parent:
this.get (' Blabla '); Although I think the value binding method should be preferred
No comments:
Post a Comment