Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Mean JS Angular App to Use Style Guide #490

Closed
britztopher opened this issue Mar 24, 2015 · 11 comments
Closed

Mean JS Angular App to Use Style Guide #490

britztopher opened this issue Mar 24, 2015 · 11 comments

Comments

@britztopher
Copy link

I am wondering if we could start following the john papa style guide for the angular application. It proves to serve a lot of great ideas and fundamentals.

https://github.com/johnpapa/angular-styleguide

@ilanbiala
Copy link
Member

@britztopher Any initial changes that you think should be made?

@SOSANA
Copy link

SOSANA commented Mar 24, 2015

Maybe I am miss understanding but we are doing this already for v4.0 we changed the file structure similar to what he recommends...

John Papa - 10 AngularJS Patterns - Code on the Beach 2014
around 4:49
https://www.youtube.com/watch?v=UlvCbnKAH3g
image

@ilanbiala
Copy link
Member

I'm sure there are other things that could be changed, but I don't think everyone will necessarily agree with everything he recommends.

@britztopher
Copy link
Author

@ilanbiala I would say these would be a good start:

  1. Use IIFE's - https://github.com/johnpapa/angular-styleguide#iife
  2. Controllers - https://github.com/johnpapa/angular-styleguide#controllers
    a. the whole section is really good and would be that hard to change some files
  3. services - https://github.com/johnpapa/angular-styleguide#services

I mean I seem to follow the whole guide with a little deviation from folder/file structure, which makes code a lot easier to read and maintainable. Also, the style guide does point out some good reasons why to do certain things. Like why to use IIFEs.

@SOSANA the structure is on the ball, however, internals are not.

@Shrizzy
Copy link

Shrizzy commented Mar 24, 2015

Great idea @britztopher
One of the first things I do with a new meanjs app is split up the controllers into smaller components, remove the ng-init's and change the controllers to 'Controller as'.
I'd really like to see the Controller As syntax, and removed references to $scope as we edge closer to Angular 2.0.

@aarosil
Copy link

aarosil commented Mar 24, 2015

This not entirely related but I think an awesome feature would be to be
able to provide your own templates to the generator. Then one can follow
whatever style one likes or needs.

I often scaffold an app, then customize one module for specific needs of
that app, and after that I use yo to generate a new vertical module, and
replace the autogenerated files with what I customized and do a global
search and replace for the object name.

On Mon, Mar 23, 2015 at 10:28 PM, Shristi Sharma notifications@github.com
wrote:

Great idea @britztopher https://github.com/britztopher
One of the first things I do with a new meanjs app is split up the
controllers into smaller components, remove the ng-init's and change the
controllers to 'Controller as'.
I'd really like to see the Controller As syntax, and removed references to
$scope as we edge closer to Angular 2.0.


Reply to this email directly or view it on GitHub
#490 (comment).

@julius-retzer
Copy link

+1 for using John Papa's style guide.

@simison
Copy link
Member

simison commented Apr 11, 2015

Sounds like we could finally get rid of pre written annotations as well:

write:

angular.module('articles').controller("ArticlesController", function($scope, $stateParams, $location, Authentication, Articles) {
});

instead of:

angular.module('articles').controller('ArticlesController', ['$scope', '$stateParams', '$location', 'Authentication', 'Articles',
    function($scope, $stateParams, $location, Authentication, Articles) {
}]);

...and let ng-annotate do the job.

Read more from style guide

@simison simison mentioned this issue Jul 10, 2015
5 tasks
@jloveland
Copy link
Contributor

+1

This was referenced Jul 17, 2015
@mleanos
Copy link
Member

mleanos commented Aug 11, 2015

+1

@ilanbiala
Copy link
Member

Closing in favor of #636.

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

No branches or pull requests

9 participants