Caching the comments count only seems to work with a page reload. I am using ajax to add comments and updating the count in create.js.erb: $('#comments_count').html('<%= @article.comments.size %>'); ... when using the cached version the value is not yet updated at this point?
Another great cast.
Caching the comments count only seems to work with a page reload. I am using ajax to add comments and updating the count in create.js.erb:
$('#comments_count').html('<%= @article.comments.size %>');... when using the cached version the value is not yet updated at this point?I did:
app.factory "Entry", ["$resource", ($resource) -> $resource("/entries/:id", {id: "@id"}, {update: {method: "PUT"}, destroy: { method: 'DELETE' }}) ]Then pass in the $index parameter when delete function is called:
delete function:
$scope.deleteEntry = (arrayIndex) -> entry_to_be_deleted = $scope.entries[arrayIndex] Entry.remove({id: entry_to_be_deleted.id}) $scope.entries.splice arrayIndex, 1