Changed Angular to $resource