5 ms·
Why I was Wrong to be Afraid of Angular.js, Part 2
- singingfish 13y agoWe've been doing well encapsulated, tricky back end stuff for a while. Started with angular over the last month. Angular basically achieves the same proper separation of concerns that our perl-based back end tools do. Angular is not really interesting because it's the new big thing. It's really interesting because it's right. (bitch of a learning curve though).
- lukasm 13y ago> bitch of a learning curve though The problem is that you have to change your mindset from server rendered pages + jQuery. Second problem is with UI directives. Nice abstraction and encapsulation, but try to restyle something easily.
- singingfish 13y agoI've been having some success by handing my look and feel over to a css specialist whith instructions along the lines of "make my prototyping less of a hack". So far she hasn't had to be aware of any code related issues.
- AdrianRossouw 13y agoI think it's interesting in that it proves that the web components approach is going to be a valid and attractive way to solve certain types of problems. I think that it started us off into a bold new direction, and due to it's popularity will increase the general audience who would be attracted to it or related systems. I don't know if it's going to still be around if/when we reach whatever the 'platonic ideal' of this approach to web applications is.
- singingfish 13y agoYeah I kind of agree. Which is why I'm more interested in it because it's "right" rather than because it's trendy.
- bdg 13y agoI find the architecture of ng fits a vast number of projects I work on very elegantly, however, I feel like I am learning to walk all over again.Things I could do in a day take me a week to learn, but I feel like my learning is progressing fast enough that I will be skilled at its use in a week.
- lerouxb 13y agoI agree with just about everything in the post, but: > I think the fact that the Angular community has made real progress towards divorcing themselves from jQuery is one of the most encouraging signs for their future. The design of Angular is just different enough, and it is just compelling enough, that it has convinced a whole range of developers to build a new generation of libraries that I suspect are more likely to be suited to whatever the next iteration of the web as a platform will look like. This part bothered me a bit. The article doesn't make the case for why jQuery needs replacing or why all that duplicate effort is a good thing. Don't get me wrong: I'm not married to jQuery and I'm open to the idea of there being a better way. I just don't find the idea that we have to move away from jQuery that self-evident.
- Bahamut 13y agoPerformance is a big one for many. There are also some patterns that developers using jQuery tend to adopt that has performance ramifications, such as use of global DOM selectors like $('.foo').
- camus2 13y ago> Performance is a big one for many. Given how poor Angularjs performs that's not really the point of Angular. > such as use of global DOM selectors like $('.foo'). Which is perfectly valid especially when doing event delegation. The point of Angular is not to replace jQuery,the point of Angular is to have a clean way to integrate DOM manipulation into pages that have a complex application logic. Something devs should do with or without AngularJS,just that Angular forces (some) S.O.C.* But one still does DOM manipulation in directives. with jQLite BUNDLED with Angular. AngularJS is no magics ,AngularJS has its own limited jQuery. Makes sense because the unique point of jQuery is DOM manipulation,not building applications with complex logic. So people saying "I replaced this fairly large jQuery app with AngularJS" are lying, You cant write a "fairly large app" just with jQuery,You need to roll your own framework on top of it, at least. * : My advice to anyone jumping in the next framework bandwagon is never couple your application logic to any framework. But that's what we see with AngularJS, everything in controllers or services tied to AngularJS apis... so much for separation of concerns...
- AdrianRossouw 13y agoThis is part 2 of this discussion : https://news.ycombinator.com/item?id=7384937 https://news.ycombinator.com/item?id=7384937
- ahuth 13y agoYou don't need to worry about dependency injection breaking when your code is minified. You can supply a list of the dependencies as strings, and minified code will work fine: angular.module("whatever").controller("YourController", ["dep1", "dep2", function (dep1, dep2) { whatever... }]); Even though the `dep1` and `dep2` params get minified, angular will still pass in the correct dependencies.
- lerouxb 13y agoShouldn't that just be the only and correct way, then? No need for .toString() magic..
- ahuth 13y agoSure, that makes sense to me. Looks like I misunderstood the author's intent. This should be the only way, though. Also, I didn't even realize that this way doesn't require .toString magic.
- lerouxb 13y agoActually I'm not 100% sure it that it doesn't require toString magic at all, but it would at least require less and probably be more reliable.
- aidos 13y agotoString is only used to parse the function signature to get the list of dependencies. If you use the other syntax it doesn't have to do the "magic" at all. I haven't looked at the output (though the magic function itself is pretty simple) but I would imagine it just creates the explicit version that you can choose to write manually. I'm a little torn myself; on the one hand, I prefer explicit code without magic. Having said that, you often need quite a few dependencies and it's a pain, and ugly, to write them all out twice on all your signatures.
- ahuth 13y agoAgreed. And at least it's more clear that dependencies are being injected.
- deleted 13y ago[deleted]
- deleted 13y ago[deleted]
- lukebase 13y agoAt this point would it be a better use of my time to learn ember or angular?
- otikik 13y agoAm I the only one who can't stand Angular simply because of its naming?
- scotty79 13y agoAngular seems not to have much of actual models (not view models), it's all about the view components and syncing them with their view models. Backbone doesn't have much support for the views, it's all about models and collections and syncing them to the server. Yet people don't seem to be too eager to use both together. Why do you think that is?
- jaxytee 13y agoBecause their cores solve the same problems, and it would be overkill to pull in both projects for views or models. Also, I don't think backbone.js models solve any problems in an Angular application.
- scotty79 13y agoCould you point me to some tutorial how to implement client side business models in Angular autosynced to the server, backbone style? From what I've seen on Angular people are really hyped about extending html and two way binding but when it comes to communication with the server they just wrap arbitrary ajax call done via $http or $resource in Angular service or factory or provider and call it a day. After seeing what backbone does, this seems to me to be as reckless as manipulating the DOM using jQuery.
- jaxytee 13y agoBecause their cores solve the same problems, and it would be overkill to pull in both projects for views or models. Also, I don't think backbone.js models solve any problems in an Angular application.
- hellbanTHIS 13y agoI love it but it's sometimes not as smart as it thinks it is. For instance they removed ng-bind-html-unsafe (because "safety"! Thanks Ralph Nader!) and now you have to jump through all kinds hoops to add a simple ng-click to a dynamically generated element. That's something that can be done in 30 seconds with jQuery but my determination in making it work the 'Angular Way' has turned it into a 48 hour Donald Duck cartoon.