DS#lastModified(resourceName[, id])

Return the timestamp of the last time either the collection for resourceName or the item of type resourceName with the given primary key was modified.


You can call DS#lastModified multiple ways

  • DS#lastModified(resourceName[, id])
  • Resource#lastModified(id) - Where Resource was created by DS#defineResource
resourceNamestringThe name of the resource to use. Unnecessary if calling lastModified directly on a Resource.
idstring or numberThe primary key of the item whose last modified timestamp is to be retrieved.
// same as store.lastModified('document', 45)
Document.lastModified(45); // undefined

Document.find(45).then(function (document) {

  Document.lastModified(45); // 1234235825494

Using lastModified to watch an item for changes in Angular:

// watch an individual item
$scope.$watch(function () {
  return User.lastModified(1234);
}, function () {
  // do something, like:
  $scope.user = User.get(1234);

// watch the whole collection
$scope.$watch(function () {
  return User.lastModified();
}, function () {
  // do something, like:
  $scope.users = User.filter({
    where: {
      age: {
        '>': 30
See also


Need help?

Want more examples or have a question? Ask on the Slack channel or post on the mailing list then we'll get your question answered and probably update this wiki.