C
C
caps.com2014-08-16 18:35:31
JavaScript
caps.com, 2014-08-16 18:35:31

How to properly name folders/files in Angularjs?

Hello!
Tell me, please, how to correctly name folders and files, if we are talking about:
1. Directive

angular.module('directives.selectBox', [])
    .directive('selectBox', function () {})

\common\directives\selectBox\selectBox.js or \common\directives\select-box\select-box.js
2. Service
angular.module('services.carService', [])
    .service('carService', function () {})

\common\services\carService\carService.js or \common\services\car-service\car-service.js or \common\services\car.service\car.service.js
3. Module
angular.module('postDetails', [])
\common\modules\postDetails\ postDetails.js or \common\modules\post-details\post-details.js or \common\modules\post.details\post.details.js I've
read different style-guides and the information is different. Is there a standard?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Romanov, 2014-08-17
@caps.com

1. Directive
Named so and so. The recommendation is select-box.js but also name selectBox.js or selectBoxDrv.js if this file is not in the directives folder.
For services and modules, there is definitely a caml case.
I advise you to look at the lesson of Joe Eames, Who to organize your code.
beta.pluralsight.com/courses/angular-best-practices

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question