The exact question wasn't asked before. I am getting both Warning and Uncaught Error as below:
I set firebase rules to:
{
"rules": {
".read": true,
".write": true
}
}
Some of the code:
For edit form in templates/contacts folder (using editContact
action):
//templates/contacts/edit.hbs
<form>
<div class="form-group">
<label>First Name</label>
</div>
<div class="form-group">
<label>Last Name</label>
</div>
<div class="form-group">
<label>Mobile No</label>
</div>
<div class="form-group">
<label>Phone No</label>
</div>
<button class="btn btn-primary">Edit Contact</button>
</form>
For controller of edit:
//controllers/contacts/edit.js
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
editContact: function(id){
var self = this;
var firstName = this.get('firstName');
var lastName = this.get('lastName');
var mobile = this.get('mobile');
var phone = this.get('phone');
//Update Contact
this.store.findRecord('contact', id,{ reload: true }).then(function(contact){
contact.set('firstName', firstName);
contact.set('lastName', lastName);
contact.set('mobile', mobile);
contact.set('phone', phone);
// Save to Database
contact.save();
}).then(function(){
self.transitionToRoute('contacts');
});
}
}
});
But it still didn't work. What could be the problem?
Aucun commentaire:
Enregistrer un commentaire