From the $resource docs:
If the parameter value is prefixed with @ then the value of that parameter is extracted from the data object (useful for non-GET operations).`
You are specifying that the topicId
will be the id
of the object you are using.
$resource('/topics/:topicId', {topicId: '@id'});
// ^^^^^^^^^^^^^^
// Here is where you are mapping it
You want to pass id: topicId
so that it will map id
to topicId
in the URL.
var newPost = new Topics({
id: topicId
});