Reputation: 23
I've built a test app with ember-app-kit. I want to add a new route "analysis" but i get an error when i try to load it.
this is the main app file
var Exe = window.Exe = Ember.Application.create();
This is the route file
Exe.ApplicationRoute = Ember.Route.extend({
});
Exe.AnalysisRoute = Ember.Route.extend({
});
this is the map file
Exe.Router.map(function () {
this.resource('analysis');
});
and I've also 3 file, application.hbs, index.hbs, and analysis.hbs, in order: application
<div>
<div class="container" id="main">
<div class="row">
<div>
<div class="col-md-12">
{{outlet}}
</div>
</div>
</div>
</div>
</div>
index
<div>
<button type="button">{{#link-to 'analysis'}} Analysis {{/link-to}}</button>
</div>
analysis
<div>
<h1 class="bs-docs-featurette-title">Analysis</h1>
</div>
When i lunch grunt and i go to localhost:9000/analysis i see a 404
Cannot GET /analysis
or if i click on the button link doesn't seems to do anything. I've checked the app with ember-inspector and the view doesn't appear.
EDIT: I've found the solution
<div>
{{#link-to 'analysis'}}<button type="button">Analysis</button>{{/link-to}}
</div>
Upvotes: 1
Views: 211
Reputation:
This is not about being able to find the template. Ember is trying to get the model for analysis by making an AJAX call. This fails, and the error stops the transition. To turn this behavior off, implement a null model
hook in AnalysisRoute
.
Upvotes: 1