Wednesday, 15 May 2013

ember.js - Blocked in displaying logins via connectOutlet in trek tutorial -



ember.js - Blocked in displaying logins via connectOutlet in trek tutorial -

i'm next tutorial here http://trek.github.com/ , i'm @ blocked point.

ember code in index.html:

<script type="text/x-handlebars" data-template-name="application"> <h2>ember committers:</h2> {{outlet}} </script> <script type="text/x-handlebars" data-template-name="contributors"> {{#each person in controller}} {{person.login}} {{/each}} </script>

ember code in app.js:

app = ember.application.create(); // application default controller , view app. applicationcontroller = ember.controller.extend(); app.applicationview= ember.view.extend( { templatename: 'application' }); // contributors controller , view... app. allcontributorscontroller = ember.arraycontroller.extend(); app.allcontributorsview= ember.view.extend( { templatename: 'contributors' }); app.router = ember.router.extend({ root: ember.route.extend({ index: ember.route.extend({ route: '/', connectoutlets: function(router) { // here connect allcontributers info & template outlet in application template. router.get('applicationcontroller').connectoutlet('allcontributors', [{login:'wycats'},{login: 'tomdale'}]); } }) }) });

at point when run it, expect see text "ember committers:" along 2 login names specified via connectoutlet().

i see header text , not logins , don't errors.

any ideas?

i've had success when i've done routes way on emberjs.com guide page http://emberjs.com/guides/routing/defining-your-routes/

you'd define routes via

app.router.map(function(){ this.route('contributors'); });

at point, default if go #/contributors set contributors template {{outlet}} (no view declaration necessary).

if need alter outlet, within route (not router! confusion cost me day) creating 1 contributors:

app.contributorsroute = ember.route.extend({ connectoutlets: ... });

ember.js

No comments:

Post a Comment