Changed apply to $apply