Live data from Hacker News

Angular 2.0

blog.angularjs.org

41–50 of 169 posts

Re: Angular 2.0

#42
OT if you're going to insist on double spacing HTML, use "&nbps; " and not "  " otherwise you'll have a ragged left margin like the OP.

Re: Angular 2.0

#43
I have multiple friends who are very excited about Angular and one who is very excited about Knockout, so I am convinced that they are getting something right.

I am personally much more attracted to the reactive style of Meteor's Blaze or ReactJS. It seems much easier for me to reason about, but maybe this has something to do with my background in video games which means that a render-loop seems really natural to me.

I don't have enough real world experience with the former to make a comparison so I'd love to hear from someone who is able to properly compare the two styles what the real pros and cons are.

Re: Angular 2.0

#44
post #36
post #22

Earlier quoted context omitted.

This is a critique of the example, more than the framework itself. The "smart-float" directive is not a native angular directive, but rather a directive made for the example. As for the "form.length.$error.float", it probably could be a bit more concise, but is it really that bad? What would be a "more semantic" way? The main strength of angular, is that you are able to point your DOM elements to environment variable…

I'll keep this high level; that's where I have issues with Angular. Angular wants you to learn its vocabulary, and encourages users to expand it further. Like you point out, smart-float is a directive specific to the example. To me, it is a foreign object I don't recognize in html. In fact, directives, scopes? The big one. Dependency Injection, factories, modules. In JS, this is a solution looking for a problem. Ther…

My interpertation of the AngularJS DI implementation is that it exists primarily to make it easy to swap items out for testing purposes. I believe it solves that problem very well.

What alternatives do you recommend to DI?

Re: Angular 2.0

#45
post #25

Earlier quoted context omitted.

It's just the first impression. React view code is not HTML in pure sense—it's a DSL for describing virtual DOM tree (that happens to look a lot like HTML for obvious reasons). You won't regret taking a couple of hours to try to build something simple with it.

But then again, is the comparison between Angular and React even a valid one? After all, Angular is more or less MVC with a lot of functionality for resource routing, component building whereas React seems like a view templating library. So if I am not wrong, we are comparing a framework with a targeted library. The weakness with Angular is not the view imo, but the $apply-cycle which can bog down even a modern brows…

React basically eliminates the need for something like the apply cycle, because you just re-render from the top whenever something changes. React is the view layer, but its approach is different enough that you may restructure (and simplify) the rest of your app as a result.

Re: Angular 2.0

#46
post #36
post #22

Earlier quoted context omitted.

This is a critique of the example, more than the framework itself. The "smart-float" directive is not a native angular directive, but rather a directive made for the example. As for the "form.length.$error.float", it probably could be a bit more concise, but is it really that bad? What would be a "more semantic" way? The main strength of angular, is that you are able to point your DOM elements to environment variable…

I'll keep this high level; that's where I have issues with Angular. Angular wants you to learn its vocabulary, and encourages users to expand it further. Like you point out, smart-float is a directive specific to the example. To me, it is a foreign object I don't recognize in html. In fact, directives, scopes? The big one. Dependency Injection, factories, modules. In JS, this is a solution looking for a problem. Ther…

I'll agree it's not pretty to view source and see an inordinate amount of fluff in what was once your beautifully handcrafted semantic HTML. Much of this can be alleviated with templating (ng-view).

Have you taken the time to play around with angular before airing your grievances? My hunch is yes and that you may just be simplifying things for others who haven't used it yet.

For those of you who haven't had the pleasure of working with angular: Once you've familiarized yourself with the verbiage, most of jeswin's concerns here come second nature just by glancing in one's source code. Let's take the example:

    form.length.$error.float
The name form, albeit horribly chosen in this case, represents the parent form's identifier in angular (the form's name attribute). It would've made more sense to use or something more insightful so you could more easily see the name matching from HTML to JS.

$error is simply the representation of any form validation errors that may have occurred. It's standard in angular, and there's plenty of documentation. Just google for "angularjs form validation" and you'll find a million resources at your disposal.

form.length.$error.float is checking if an error exists for the validation rule float. Given the limited amount of code in the sample, we'd have to arbitrarily assume that the "smart-float" directive is implicitly setting a custom validation rule via:

    ngModel.$setValidity('float')
I'll have to agree to disagree regarding pattern usage and dependency injection. They do have a place, and it tends to be in larger applications which become a burden to maintain as your application grows. To be quite honest, I believe angular brought a simplicity to DI that has yet to be seen in many other frameworks. It entirely lowered the barrier to entry for writing testable code and heavily promoted unit testing at the same time.

Re: Angular 2.0

#47
post #36

Earlier quoted context omitted.

I'll keep this high level; that's where I have issues with Angular. Angular wants you to learn its vocabulary, and encourages users to expand it further. Like you point out, smart-float is a directive specific to the example. To me, it is a foreign object I don't recognize in html. In fact, directives, scopes? The big one. Dependency Injection, factories, modules. In JS, this is a solution looking for a problem. Ther…

My interpertation of the AngularJS DI implementation is that it exists primarily to make it easy to swap items out for testing purposes. I believe it solves that problem very well. What alternatives do you recommend to DI?

Nothing, for swapping things out. :)

In my test initialization, I'd probably just replace the value of "ns.someService" worldwide with a mock.

Re: Angular 2.0

#48
post #23
post #15

AngularJS has a J2EE mindset. Where libraries grow to become as hard to learn as programming languages themselves. It does not make semantic sense to me anymore. Here is an example from the site: Length (float): {{length}} This is not a valid float number! How semantic is ng-show="form.length.$error.float? smart-float sounds like C++. If programming languages worked like this, we wouldn't have built many apps. The pr…

I only looked superficially at React, so maybe I got something wrong, but the HTML/XML intermingled with Javascript seems extremely off-putting to me, akin to ASP/JSP/PHP.

The thing that sold me on React was this statement: "Most people make the mistake that the DOM is a place you put things."

The DOM is what the user sees. That's all. With React, you have a virtual DOM that can hold everything, not just what the user sees. It's a pure data structure, and can be manipulated as such.

Because that DOM is a pure data structure, React can figure out for you what parts have changed, and re-render those bits as needed.

Re: Angular 2.0

#49
post #15

AngularJS has a J2EE mindset. Where libraries grow to become as hard to learn as programming languages themselves. It does not make semantic sense to me anymore. Here is an example from the site: Length (float): {{length}} This is not a valid float number! How semantic is ng-show="form.length.$error.float? smart-float sounds like C++. If programming languages worked like this, we wouldn't have built many apps. The pr…

This is extremely picky. "Smart-float" is the name of a custom directive that is used as an example. The term "smart float" can be used as a React component name just as easily. In that case, your React component would "sound like C++".

Also, the "we wouldn't have built many apps" part is a stretch. It's actually the opposite, AngularJS is extremely popular and the most successful current JS framework.

Re: Angular 2.0

#50
post #15

AngularJS has a J2EE mindset. Where libraries grow to become as hard to learn as programming languages themselves. It does not make semantic sense to me anymore. Here is an example from the site: Length (float): {{length}} This is not a valid float number! How semantic is ng-show="form.length.$error.float? smart-float sounds like C++. If programming languages worked like this, we wouldn't have built many apps. The pr…

Totally agree and also recommend to look at React. While Angular is just way too much of everything React is pretty much thought-out:

Here a quick comparison of both: http://versus.com/en/angularjs-vs-react

Here a pretty good video of React's founder pointing on some weakness of Angular: http://www.youtube.com/watch?v=x7cQ3mrcKaY

Post reply on HN