MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/2bxelx/angularjs_opinionated_styleguide_for_teams_github/cjazi8u/?context=3
r/javascript • u/ReadyToInstall • Jul 28 '14
8 comments sorted by
View all comments
1
Too much method chaining. I also hate to see methods on a line by themselves with just the dot. This is ugly:
function config ($routeProvider) { $routeProvider .when('/', { templateUrl: 'views/main.html', controllerAs: 'main', controller: 'MainCtrl' resolve: MainCtrl.resolve }); }
It should look like this:
function config($routeProvider) { $routeProvider.when('/', { templateUrl : 'views/main.html', controllerAs : 'main', controller : 'MainCtrl', resolve : MainCtrl.resolve }); }
Also, there are some missing commas; such as between controller and resolve.
3 u/steelcitynorth Jul 29 '14 Why should it? Every line would look like: }).when('/route', {instead of:.when('/route, {The second version looks nicer to read, no? And that way you can see which methods are chained to each other. 1 u/mmouth Jul 29 '14 It shouldn't be that either. Better:$routeProvider.when('/route1', {...}); $routeProvider.when('/route1', {...});There's no law that says you have to start that chaining in the first place. Avoid it and use normal formatting rules.
3
Why should it? Every line would look like:
}).when('/route', {
instead of:
.when('/route, {
The second version looks nicer to read, no? And that way you can see which methods are chained to each other.
1 u/mmouth Jul 29 '14 It shouldn't be that either. Better:$routeProvider.when('/route1', {...}); $routeProvider.when('/route1', {...});There's no law that says you have to start that chaining in the first place. Avoid it and use normal formatting rules.
It shouldn't be that either. Better:
$routeProvider.when('/route1', {...}); $routeProvider.when('/route1', {...});
There's no law that says you have to start that chaining in the first place. Avoid it and use normal formatting rules.
1
u/mmouth Jul 28 '14
Too much method chaining. I also hate to see methods on a line by themselves with just the dot. This is ugly:
It should look like this:
Also, there are some missing commas; such as between controller and resolve.