ember.js - Problems with setting up a basic Ember app -
i starting out ember. installed per documentation. when go http://my-app:4200 'my application' show. however, when go http://my-app:4200/boxes view doesn't show contents of boxes.hbs template ("hello there boxes template!") - ideas why not (files below)?
app/router.js:
import ember 'ember'; import config './config/environment'; var router = ember.router.extend({ location: config.locationtype }); export default ember.router.extend().map(function(){ }); router.map(function() { this.route('boxes', { path: '/boxes' }); });
app/routes/application.js:
export default ember.route.extend({ setupcontroller: function(controller) { controller.set('title', "my application"); } });
app/templates/application.hbs :
<h2>{{title}}</h2> <div class="main"> {{outlet}} </div>
app/templates/boxes.hbs :
<p>hello there boxes template!</p>
your problem location type wrong. here difference. ember cli defaults auto
routing setting, falls hash-based routing it's compatible across browsers. means ember expecting go #/boxes
not /boxes
. can either put hash in url when typing out url manually, or change locationtype
history
in config/environment.js
file. (note history-based routing doesn't work in ie <10.)
Comments
Post a Comment