lundi 17 septembre 2018

Why does my routing doesn't work in Ember Js?

I'm working on a todoApp with a rails API and frontend as Ember. I've followed this tutorial Ember todo App However, it a bit old and I kinda lost in my routing.

I've a todos.hbs which should be rendered localhost:4200/, but it is a clear page.

Here's what my router.jslooks like :

import EmberRouter from '@ember/routing/router';
import config from './config/environment';

const Router = EmberRouter.extend({
  location: config.locationType,
  rootURL: config.rootURL
});

Router.map(function() {
  this.resource('todos', { path: '/' });
});

export default Router;

And my routes/todos.js:

import Route from '@ember/routing/route';

export default Route.extend({
  model: function() {
    return this.store.find('todo');
  }
});

On my application.hbs, there's only an ```

and my todos.hbs looks like this :

<section id="todoapp">
  <header id="header">
    <h1>todos</h1>
  
  </header>

  <section id="main">
  <ul id="todo-list">
  
    <li >
    
      
    
        
        <label ></label>
      <button  class="destroy"></button>
    
    </li>
  
  </ul>

    <input type="checkbox" id="toggle-all">
  </section>
</section>

<footer id="info">
  <p>Double-click to edit a todo</p>
</footer>


So now, I dont know where the mistake is, it only rendered me a blank page. If anyone can explain what is wrong into my work, I would appreciate.




Aucun commentaire:

Enregistrer un commentaire