mercredi 10 août 2016

Loading data that isnt on the route?

I have a dropdown setup on a form but how do i set it up if my data isnt in the route? I am trying to load in a list of territories on a new dealer form. I have added ember-power-select add on but I cant figure out how to load the data to the add on to display the available options. Do I need to create a service or controller?

New to ember just trying to work through the basics.

  Router.map(function() {
  this.route('login');
  this.route('admin', function() {
    this.route('territory', function() {
      this.route('new');
      this.route('edit', { path: '/:territory_id/edit'});
      this.route('view', { path: '/:territory_id/view'});
    });
    this.route('dealer', function() {
      this.route('view', { path: '/:dealer_id/view'});
      this.route('new');
    });
  });
});

This is my form I am using on creating a new item.

<div class="well">
    <form class="form-horizontal">
        <fieldset>
            <legend>New Dealer</legend>
            <div class="form-group">
            <label for="inputFirstName" class="col-lg-2 control-label">Name</label>
            <div class="col-lg-4">
                
            </div>
            </div>
            <div class="form-group">
            <label for="inputFirstName" class="col-lg-2 control-label">Territory</label>
            <div class="col-lg-4">
                 
                      
                
            </div>
            </div>
            <div class="form-group">
            <div class="col-lg-10 col-lg-offset-2">
                Cancel
                <button type="submit" class="btn btn-primary" >Submit</button>
            </div>
            </div>
        </fieldset>
    </form>
</div>




Aucun commentaire:

Enregistrer un commentaire