*sort of
I don't want to see even one more blog post that uses the term "MVC" to describe (and attack) a pattern that many frameworks use.
— Yehuda Katz (@wycats) April 30, 2014
The Router contains your route names and controls the URLs
App.Router.map(function() {
this.resource('students', function() {
this.route('top');
this.resource('student', { path: '/:student_id' });
});
});
Routes and the Router is one reason Ember is special
"you got some good routing there, ember.js...would be a shame if something HAPPENED TO URLS" -google
— JennpireJS (@jennschiffer) May 2, 2014
App.StudentsRoute = Ember.Route.extend({
model: function() {
return Ember.RSVP.cast($.getJSON('/api/students'));
}
});
App.StudentsController = Ember.ArrayController.extend({
males: function() {
return this.get('content').filterBy('gender', 'male').get('length');
}.property('content.@each.gender'),
females: function() {
return this.get('content').filterBy('gender', 'female').get('length');
}.property('content.@each.gender')
});
<ul>
{{#each item in model itemController="student"}}
<li>{{full_name}}<li>
{{/each}}
</ul>
Males: {{males}}<br>
Females: {{females}}