3 ms·
foo.controller.js foo.service.js foo.directive.js would all be in different folders, one for controllers, one for services one for directives etc. if you hav
by ZoeZoeBee 11y ago
foo.controller.js
foo.service.js
foo.directive.js
would all be in different folders, one for controllers, one for services one for directives etc. if you have multiple tabs open in your ide like Webstorm you'd only see foo.js three times over, if you did not prefix it, and be hard pressed to know which is which at first glance.
With that said Angular 1 is dead long live Angular 2 :)
- maaaats 11y agoNo, the point is to not have separate folders for controllers, directives etc.
- ZoeZoeBee 11y agoYes, you should have separate folders for controllers directives etc, when you are grouping by features, under the feature. Otherwise good luck telling where everything is, when you have something beyond a trivial app... I'm not suggesting putting all components in component folder and all services in services folder. https://egghead.io/lessons/angular-2-organizing-angular-2-projects-by-feature https://egghead.io/lessons/angular-2-organizing-angular-2-pr...
- maaaats 11y agoWe have something far beyond a trivial app, and still never have folders for controllers etc. If a feature becomes big enough that this is needed, e.g. more than a few components, they are split up and grouped in several subfolders.
- ZoeZoeBee 11y agoThat is why they are called style guides and are opinions. No need to go telling someone they are wrong simply because you do not see the benefit to it...
- Roboprog 11y agoWhy would I use Angular 2 instead of React? I hope "somebody" forks Angular 1. The 2 way binding (ng-model) makes CRUD apps very simple to write, even if digest/watch type operations are somewhat slow. As far as I can tell, the ng-model feature is OUT of Angular 2, and some kind of React style event communication must be set up instead. I don't know React yet, but Angular 2 sounds like they are chasing the same design goals: be efficient at gluing huge mounds of similar crap to a never ending page (e.g. - a la Facebook). I am more interested in quickly grinding out code for huge CRUD forms with a large number of distinct fields.
- ZoeZoeBee 11y agoYes both are ways to deal with single page applications... 2 way data-binding is still in Angular2, as well as oneWay Binding to the input and one way binding from output. I've heard others make the claim ng-model and 2 way binding are gone, which is wrong. https://egghead.io/lessons/angular-2-using-ng-model-for-two-way-binding https://egghead.io/lessons/angular-2-using-ng-model-for-two-... There are giant performance benefits on the horizon with Angular2 in terms of server side rendering with Angular Universal and state management with ngrx/store. In Angular2 http is handled as an observable, no longer a promise, so there is a difference in syntax but that falls in line with ES7 format
- Roboprog 11y agoThanks for the update. As far as I could piece together (admittedly dubious connections), ngModel was re-implemented in the Jan 2016 release of Angular 2??? ("Angular 2.0.1 beta" from a Stack Overflow discussion assumed to mean 2.0.0-beta.1 on https://code.angularjs.org/ https://code.angularjs.org/) Sounds like somebody beat some sense into the Angular 2 team - "don't remove the single feature that differentiates your library and makes prototyping an app easy" Now if I can only find examples in good old Javascript, instead of fugly, Java-esque, Typescript. Re: types/Typescript - loved this quote: "Better type-checks interestingly found only just a few bugs" https://jaxenter.com/angularjs-interview-angular-2-typescript-and-a-release-date-123674.html https://jaxenter.com/angularjs-interview-angular-2-typescrip... Rant for another day: insisting on static typing, but ignoring the mayhem caused by operators and operator precedence (to say nothing of user created operators)