angular-restmod
angular-restmod copied to clipboard
$new does not populate primary key field.
Hello!
I love this library, it handles collections and relations so much better than ngResource (that is: it handles them at all.)
The issue:
Calling $new(
restmodProvider.rebase({
$config: {
primaryKey: 'id'
},
})
var SomeModel = restmod.model('/foo')
SomeModel.$new(1).id // <== Is undefined.
A workaround at the moment is with this hook:
'after-init': function() {
if (typeof this.id === 'undefined') {
this.id = this.$pk;
}
}