ember.js - Is "basic" a reserved route name in Ember? -
i have route in ember app called "basic" corresponding name of api endpoint.
this route doesn't work - links don't render template.
here's jsbin demonstrating failure: http://emberjs.jsbin.com/hisoxadi/1
js:
app = ember.application.create(); app.router.map(function() { this.route('basic'); this.route('test'); }); app.indexroute = ember.route.extend({ model: function() { return ['red', 'yellow', 'blue']; } });
templates:
<script type="text/x-handlebars"> <h2> welcome ember.js</h2> {{#link-to 'index'}}index{{/link-to}} {{#link-to 'basic'}}basic route{{/link-to}} {{#link-to 'test'}}test route{{/link-to}} {{outlet}} </script> <script type="text/x-handlebars" data-template-name="basic"> basic route here </script> <script type="text/x-handlebars" data-template-name="test"> test route here </script> <script type="text/x-handlebars" data-template-name="index"> <ul> {{#each item in model}} <li>{{item}}</li> {{/each}} </ul> </script>
to expand on comment bit, basic
indeed reserved word. specifically, it's reserved word resolver. can see source here.
userouternaming: function(parsedname) { parsedname.name = parsedname.name.replace(/\./g, '_'); if (parsedname.name === 'basic') { parsedname.name = ''; } },
and because of way ember.js looks routes , controllers in container, it's fair bet there's no way around without major code changes. there should documentation issue filed this.
edit: created issue here.
Comments
Post a Comment