last day (15 days later) » 

9:17 PM
0
A: Render output outside the template

OliverOne simple and straight forward solution would be: <script type="text/x-handlebars" data-template-name="index"> <div id="section_a"> First value: {{input type="text" value=one}}<br> Second value: {{input type="text" value=two}}<br> Result: {{result}} </div> <div id="section_b">

 
Yea of course, but there are other things in the page that complicates stuff. So my code is a simplification for the purpose of readility.
 
Do you have a template || controller for your "section_b", too?
 
(( No I do not))
 
ok.. which template contains section_b?
 
No template yet. It's just another part of the document.
 
9:17 PM
Then it's outside the scope of your ember app and you can not use embers data binding abilities.
 
No workaround? Create a new template or something else? (Sorry for putting these beginner questions...)
 
how does your html actually look like?
 
It's not super complicated but I want to display the return value in two different places.
 
i know
 
One in the template "where it belongs", and the other place is in the middle of a form, that doesn't belong to Ember at all.
I've received two answers that seem valid, but for a beginner it's not 100% obvious:
1. Nest the Index controller in the Application controller
2. Make an outlet through the Router
 
9:22 PM
sure... where is your first outlet
are you aware of the fact, that ember doesn't render templates in place where they may be specified?!
 
Yea the second answer complicates stuff because I don't even have anything defined in the Router... It's just:

App.Router.map(function() {
});
What do you mean, where doesn't Ember render templates?
 
ok... then you have an application context and an index context within by default
 
I assume so, yes.
(Just to clarify, the app is working perfectly.)
(Except for this new scenario, where I want to output the return value outside the template.)
 
let's use this jsbin
for demonstration
i pasted your code there
there you go... i think this is what you wanted to accomplish
 
Looks great!
 
9:38 PM
I know... I did it :D
 
:)

But just so that I get this, now the index template isn't outputting any results?
Both sections are now encapsulated in the application template?
 
9:52 PM
I guess I cannot have multiple templates, right?
 

last day (15 days later) »