5 ms·
One way to think about Angular is like this: Different modules on your page are broken down into components, which are like "regular" HTML tags except that they
by jashmenn 10y ago
One way to think about Angular is like this: Different modules on your page are broken down into components, which are like "regular" HTML tags except that they have JavaScript functionality attached to them. Your app is a tree of components.
React is great as well, but if you find Angular incomprehensible it's not clear you'll find React much easier.
One major difference between React and Angular is that the Angular community _tends_ to separate their templates from their "controller" code, whereas the React community _tends_ to intermix their templates with code ("PHP" style).
The result is that in Angular you have a few funny characters in your HTML to learn (e.g. `*ngFor="let foo in bar"` for looping) whereas in React you'll use JSX and use JavaScript for loops.
It's pretty clear to me that component-based webapps are here for the long haul. Even if WebComponents ends up being the future, the concepts you learn in using either Angular or React will be more-or-less transferrable.
It seems to me that Angular and React are becoming more similar over time. For typing, Angular uses TypeScript and React uses Flow. For data architecture, both communities are gravitating towards some sort of Flux (redux / ngrx). You can even use JSX in Angular if you want to.
Shameless plug: I've written a book on Angular 2 which talks through, step-by-step, how to understand Angular. The first chapter walks you through your first app and you can get it (for free) here: https://www.ng-book.com/2/ https://www.ng-book.com/2/
- nawitus 10y agoWhy use Angular 2 when you can use web components?
- zip1234 10y agohttp://caniuse.com/#search=components http://caniuse.com/#search=components Because you can't practically use web components. Only Chrome and Opera support them. Angular2 has support down to IE 9.
- rictic 10y agoThe web components polyfills have support down to IE 10: https://github.com/webcomponents/webcomponentsjs https://github.com/webcomponents/webcomponentsjs
- Touche 10y agoYeah but there's a separate "lite" version for a reason, Shadow DOM support requires wrapping nearly every DOM API. Web Components without Shadow DOM aren't that interesting.
- pfooti 10y agoStart with this: https://github.com/webcomponents/webcomponentsjs/issues/212 https://github.com/webcomponents/webcomponentsjs/issues/212 Which is why I stopped messing around with polymer. Basically adding the webcomponents polyfill to your DOM tree (because it touches so many things) breaks contenteditable in some weird ways. Which can be limiting to people who use rich text editors (many still decorate contenteditable divs) although iframe-wrapping the editor fixes the contenteditable breakage (at the expense of introducing other problems with extending your editor - try adding custom (say) atmention autocompletes to something in its own execution context). Also, webcomponents have had some pretty major syntax changes over time, especially when it comes to shadow-piercing styling vs other styling selectors. Ultimately, I'm looking forward to webcomponents. I can't wait to have proper namespaces and all that. In the short run, though, I've tried the webcomponents polyfill (I wrote a lot of polymer 0.X code for a webapp that I eventually ported to angular 1.x instead when the polymer 1.x syntax meant I'd have to rewrite a lot anyway), and it's not Enough.
- deleted 10y ago[deleted]
- nkw 10y agoLest anyone disregard the plug for the book because it comes from the author, I don't have any affiliation with the book or author, but can attest it is a very nice guide to Angular 2. During the alpha/beta process the angular developers have been making breaking API changes right and left (which is ok, they said they were going to during the development releases), but the ng-book 2 has been kept reasonably up to date through the process. I found it to be very helpful in getting a handle on angular2 -- much more so than all the sample projects or how-to pages mainly due to everyone preferring different tooling or build workflows which required more time to figure out what was going on there rather than learning the angular2 part. The book was much more pleasant to read and work through than all the how-to pages or seed projects on github. FWIW.