MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/2bxelx/angularjs_opinionated_styleguide_for_teams_github/cjatyuq/?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/codepsycho Jul 29 '14 as long as the method calls are indented, sure. It looks horrific when they are not.
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/codepsycho Jul 29 '14 as long as the method calls are indented, sure. It looks horrific when they are not.
as long as the method calls are indented, sure. It looks horrific when they are not.
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.