Reputation: 178
I have created some model App.Markets
In here I am going to display "hello world".
App.DashboardController = Ember.ObjectController.extend({
test: function(){
var post = App.Markets.createRecord({
name: "NAME123",
created: "CREATED123"
});
post.one('didCreate', function() {
console.log("hello world");
});
post.save();
}
But I cannot see this message when I create a new record in App.Markets Model.
Upvotes: 1
Views: 84
Reputation: 23322
I don't know how your application setup looks like, but have a look at this simple demo that uses the FixtureAdapter
for simplicity reasons who show's that it's working.
Let me know if it helps.
Upvotes: 0
Reputation: 19050
The didCreate
hook is triggered when adapter has gotten confirmation from your API that the record was saved. If you cannot see this message it's probably because there was an error calling your API.
To see what is going on, setting the model's stateManager.enableLogging
property to true. With this in place you will be able to see console.log messages as the model transitions between states
App.DashboardController = Ember.ObjectController.extend({
test: function(){
var post = App.Markets.createRecord({
name: "NAME123",
created: "CREATED123",
"stateManager.enableLogging": true
});
post.one('didCreate', function() {
console.log("hello world");
});
post.save();
}
Upvotes: 1