move scope $apply() to listener callback