i'm struggling understand why you'd need use $emit rather using controller syntax , directly accessing & updating data on parent scope. use cases?
it's more efficient call method on parent scope directly, rather using $emit
(or $broadcast
) dispatch event. there valid reasons it.
here's reasons come mind:
- you want emit event more 1 application component can receive/process.
- you want de-couple components in future message may processed different controller (or maybe service or directive, etc.).
- you want emit event service/factory can consume (these not associated view/$scope, can inject
$rootscope
them).
Comments
Post a Comment