vendredi 28 juillet 2017

how to pass parameters between hbs files in ember

i have created an application using ember.js. here i couldn't get the parameter value passed from tasks.hbs to subtasks.hbs.how could i get parameter value passed from tasks.hbs in subtasks.hbs and print it in subtasks.hbs?

app/templates/tasks.hbs:


<h1>Tasks</h1>

    <div class="well">
        <h4></h4>
        <small>Created: </small><br>
        <small>Due: </small>
        <h5>Priority: </h5>
        <p></p>
        <button  class="btn btn-danger">Delete</button><hr>

        <button  class="btn btn-primary">Create SubTask</button>

        <button class="btn btn-primary">Show SubTasks</button>
    </div>


app/templates/subtasks.hbs:


<h1>SubTasks</h1>
<h2></h2>

<h1></h1>

    <div class="well">
        <h4></h4>
        <small>Created: </small><br>
        <small>Due: </small>
        <h5>Priority: </h5>
        <p></p>
        <button  class="btn btn-danger">Delete</button>
    </div>



app/routes/tasks.js:

import Ember from 'ember';

export default Ember.Route.extend({
    model(){
        return this.store.findAll('task');
    }
});

app/routes/subtasks.js:

import Ember from 'ember';

export default Ember.Route.extend({
    model(){
        return this.store.findAll('subtask');
    }
});

router.js:

import Ember from 'ember';
import config from './config/environment';

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

Router.map(function() {
  this.resource('tasks', function() {
    this.route('new');
    this.route('edit', {path: '/edit/:task_id'});
  });
  this.route('subtasks', {path: '/subtasks/:task_id'}, function() {
    this.route('subnew', {path: '/subnew/:task_id'});
    this.route('subedit', {path: '/subedit/:subtask_id'});
  });
});

export default Router;




Aucun commentaire:

Enregistrer un commentaire