Why template is not rendered?


#1
// routes/me/contact.js
 
import Ember from 'ember';
export default Ember.Route.extend({
  model: function() {
    return this.store.find('contact');
  }
});
 
// templates/me/contact.hbs
 
{{#each contact in contacts}}
  <div class="item clearfix">
    <div class="row hd clearfix" style="line-height: 56px;">
      <div class="col-10"><img class="avatar" {{bind-attr src=contact.avatar}}> <span class="nickname">{{contact.nickname}}</span></div>
      <div class="col-2 txt-center" {{ action 'acceptContactRequest' contact }}>
        <i class="success fa fa-check"></i>
      </div>
    </div>
  </div>
{{/each}}
 
// server/mocks/contacts.js
module.exports = function(app) {
  var express = require('express');
  var contactsRouter = express.Router();
  var routes = [];
  contactsRouter.get('/*', function(req, res) {
    var ret = {};
    ret.contacts = [{
      id: 1,
      user: 1,
      email: 'gmr.nicole@gmail.com',
      nickname: 'Nicole',
      avatar: 'http://secure.gravatar.com/avatar/f42113ba1ee96caf35500bc525d994f8',
      currency: 'CNY',
      amount: '-1.27',
      isConnected: false
    },
    {
      id: 2,
      user: 1,
      email: 'gmr.nicole@gmail.com',
      nickname: 'Nicole',
      avatar: 'http://secure.gravatar.com/avatar/f42113ba1ee96caf35500bc525d994f8',
      currency: 'CNY',
      amount: '-1.27',
      isConnected: true
    },
    {
      id: 3,
      user: 1,
      email: 'gmr.nicole@gmail.com',
      nickname: 'Nicole',
      avatar: 'http://secure.gravatar.com/avatar/f42113ba1ee96caf35500bc525d994f8',
      currency: 'CNY',
      amount: '-1.27',
      isConnected: true
    },
    {
      id: 4,
      user: 1,
      email: 'gmr.nicole@gmail.com',
      nickname: 'Nicole',
      avatar: 'http://secure.gravatar.com/avatar/f42113ba1ee96caf35500bc525d994f8',
      currency: 'CNY',
      amount: '-1.27',
      isConnected: true
    }];
    res.send(ret);
  });
  routes.push(contactsRouter);
  app.use('/api/contacts', contactsRouter);
};

#2

It’s been solved.

In template, I should use model instead of contacts to get the model.