add $apply method