Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broadcasts in controllers (Y031) #541

Closed
sebastianhaas opened this issue Sep 28, 2015 · 4 comments
Closed

Broadcasts in controllers (Y031) #541

sebastianhaas opened this issue Sep 28, 2015 · 4 comments

Comments

@sebastianhaas
Copy link

Hey! I'm having some trouble understanding the following sentence from Y031:

Consider using $scope in a controller only when needed. For example when publishing and subscribing events using $emit, $broadcast, or $on consider moving these uses to a factory and invoke from the controller.

While the Why? is perfectly clear to me, I'm somehow missing the answer to this very specific issue. How do I move a possible event registration, e.g. $scope.$on() to a factory? Can somebody provide some code for demonstration?

However I do understand that it is possible to avoid broadcasts at all with the use of factories. Is that the proposition of the above sentence?

@sebastianhaas
Copy link
Author

I just realized that there is already an Issue opened on that topic #398 that I must have overlooked at first. I will move my question there.

@sebastianhaas
Copy link
Author

Since there was no response in the other ticket I'll reopen this.

@sebastianhaas sebastianhaas reopened this Oct 7, 2015
@johnpapa
Copy link
Owner

johnpapa commented Oct 7, 2015

just closed this in #398

@sebastianhaas
Copy link
Author

Thank you. I find that section much clearer now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants