我想在包含位置的表单中输入位置,然后单击提交按钮,该位置应显示在谷歌地图中。谷歌地图应显示在下一页,我想在医院附近显示图标。
我试了但是我没有。
应用/模板/ 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">
{{input type="text" class="form-control" value=location}}
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="textInput2"></label>
<div class="col-md-8">
<button {{action 'addCase' model.id}} type="button" class="btn btn-primary">Submit</button>
<button type="button" class="btn btn-default">Cancel</button>
</div>
应用/路线/ newcase.js
import Ember from 'ember';
export default Ember.Route.extend({
model: function() {
return this.get('store').findAll('case');
}
});
应用/控制器/ 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: ' ',
});
}
}
});
应用/模型/ case.js
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
export default Model.extend({
location: attr('string')
});
应用/模板/组件/新case.js
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
submit() {
if (Ember.isPresent(this.get('case.location'))) {
this.set('mapIsShown', true);
}
},
}
});
我将 app / template / newcase.hbs 更改为 app / template / component / new-case.hbs
应用/模板/ index.hbs
{{新情况}}
请告诉我如何显示医院的位置和附近以及如何添加每个医院的lat,lang