4 ms·
> After all the excitement about Angular for example, I went to learn about it and just got lost with new concept DOM transclusion, scopes, services, directive
by camus2 12y ago
> After all the excitement about Angular for example, I went to learn about it and just got lost with new concept DOM transclusion, scopes, services, directives, ng-apps, controllers, dependency inversion and so on. I can use it but need someone to hold my hand. It reminded me of Enterprise Java Beans.
AngularJS has a serious "naming" problem.
Most these concept are easily understood when explained the right away,what AngularJS doc doesnt do. The only complicated thing to grasp is the digest cycle. But anything else is trivials.It's nowhere near the complexity of Java EE.
Scopes are easy,like any composite structure you have nodes with children and parents ,what make scopes special is that they can inherit properties from their parent scopes.
Directives are just custom html elements/attributes where you should do dom manipulation,all other angularjs components should be free from any DOM manipulation,Directives are the closest thing to react components.
Controllers represent the state of the view,when the data in a controller changes, a view that exposes that data changes and vice et versa.
Services are dumb objects that can be shared between controllers and dependency injection is the way one share these services. Controllers can references services ,and services can reference other services. Services are singletons
So there is nothing really complicated with all these concepts,just that the doc sucks for some reason.
- benatkin 12y agoGreat explanation. Angular attribute directives would map well to React Mixins. They take more work to set up, but with mixins code can at least be reused outside of the inheritance tree.
- bmillipede 12y agoI agree. It takes a while to get one's head wrap around AngularJS. But once you get it, it's awesome. Anyways, this is the tutorial that finally helped me get it: http://www.thinkster.io/angularjs/GtaQ0oMGIl http://www.thinkster.io/angularjs/GtaQ0oMGIl
- chc 12y agoAs the famous quote goes, there are two hard things in computer science: cache invalidation and naming things. When I first heard it, I thought it was a joke; nowadays I feel like it's barely a simplification.
- possibilistic 12y ago"And off by one errors".
- JonnieCache 12y agoI think coming to see that "joke" as deadly serious is a coming-of-age moment for all programmers.