vendredi 24 juin 2016

Display Location

I want enter the location in a form which contain location and click on submit button that location should be display in google map. the google map should be display in the next page and i want to display near by hospitals with icon.

I tried it but i am not getting.

app/template/newcase.hbs

<form class="form-horizontal">

          <div class="form-group">
            <label class="col-md-4 control-label"     for="textInput2">Location</label>
            <div class="col-md-8">
              
            </div>
          </div>

          <div class="form-group">
 <label class="col-md-4 control-label" for="textInput2"></label>
   <div class="col-md-8">
  <button  type="button" class="btn btn-primary">Submit</button>
  <button type="button" class="btn btn-default">Cancel</button>
</div>

app/route/newcase.js

import Ember from 'ember';
export default Ember.Route.extend({
 model: function() {
 return this.get('store').findAll('case');
    }
 });

app/controller/newcase.js

 import Ember from 'ember';
 export default Ember.Controller.extend({
    actions:{
           addCase: function() {
                 var location = this.get('location');
           var newCase = this.store.createRecord('case', {
              location : location
            });
  newCase.save();
  this.setProperties({
 location: ' ',
  });
  }
 }
});

app/model/case.js

 import Model from 'ember-data/model';
 import attr from 'ember-data/attr';
 export default Model.extend({
   location: attr('string')
 });

app/template/component/new-case.js

import Ember from 'ember';
export default Ember.Component.extend({
  actions: {
        submit() {
        if (Ember.isPresent(this.get('case.location'))) { 
        this.set('mapIsShown', true);
            }
  },
 } 
});

I changed app/template/newcase.hbs to app/template/component/new-case.hbs

app/template/index.hbs

please tell me how to display location and near by hospitals and how to add lat,lang of each hospitals




Aucun commentaire:

Enregistrer un commentaire