jvandemo / jvandemo/angularcodereview-com

Change "Is filtering logic handled in controller if needed?" to "Is filtering logic handled in a service if needed?"

Open
#3 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
30
Forks
6
PR merge metrics
No merged PRs in 30d

Description

I suggest changing [Is filtering logic handled in controller if needed?](https://github.com/jvandemo/angularcodereview-com/blob/master/src/angularjs/index.jade#L736) to "Is filtering logic handled in a service if needed?"

The reason behind this is that controllers should be as lean as possible which makes them easy to test. Services should provide filtered data, ready to be consumed by controllers. It also makes filter functions reusable if they are defined in services.

More info can be found in John Papa's guide [Defer Controller Logic to Services](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y035) and [Keep Controllers Focused](https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#style-y037), Minko Gechev's guide [Controllers](https://github.com/mgechev/angularjs-style-guide#controllers).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.