callback function inside digest cycle