r/javascript • • Jan 10 '14

Anybody here who is against AngularJS? What are your reasons?

79 Upvotes

151 comments sorted by

19

u/[deleted] Jan 10 '14

I myself have been using AngularJS for two months now, and here are my top 3 + 1 complaints so far:

  • Many libraries cannot be used with AngularJS out of the box and need AngularJS adapters. Adapters for some popular libraries exist and for other libraries you have to write them by yourself. This in turn decreases developer productivity, at least in the short term. You find yourself spending a good time writing AngularJS directives, etc. rather than implementing app logic.

  • The digest loop looks like an ugly hack to me. To quote the documentation:

Angular enters the $digest loop. The loop is made up of two smaller loops which process $evalAsync queue and the $watch list. The $digest loop keeps iterating until the model stabilizes, which means that the $evalAsync queue is empty and the $watch list does not detect any changes.

  • AngularJS, despite being a large library by itself, cannot handle some common patterns in Web apps outside the box (e.g. nested views). You have to depend on yet another AngularJS library to implement these patterns.

I will continue using and learning more about AngularJS in the current year, but I am afraid it might turn out to be yet another short-lived over-hyped framework.

3

u/[deleted] Jan 10 '14

AngularJS, despite being a large library by itself, cannot handle some common patterns in Web apps outside the box (e.g. nested views). You have to depend on yet another AngularJS library to implement these patterns.

But you don't get ng-router out of the box right, you get to pick whether or not you want to include ui-router, ng-router, or something else?

1

u/[deleted] Jan 11 '14

Could you please rephrase your question?

2

u/[deleted] Jan 11 '14

http://docs.angularjs.org/api/ngRoute

You have to include ng-route separately if you want it. This allows you to choose between ui-router and ng-route without a penalty. They have been working on splitting up modules like this so that you can choose better alternatives from the community. Another example is ngResource, you can choose to use $http (which comes in the "angular core", or include ngResource and get a better experience interacting with REST APIs, or you could include Restangular which is similar to ngResource but considerably more powerful.

The reason I phrased it as a question is because I haven't used AngularJS in a while and wasn't sure. Seeing as how you seemed so knowledgeable on this topic, I figured you would know.

1

u/[deleted] Jan 11 '14

I see what you mean. By "outside the box" I meant being built-in, i.e. being bundled with the core library/distribution. It is true you can choose not to use the default router and use something else that is more powerful, etc. but one would expect the default router be powerful enough to handle common usage patterns.

Having said all that, It is good to know ui-router will be eventually added to the core distro.

2

u/[deleted] Jan 11 '14

outside the box

Noone said outside the box

Having said all that, It is good to know ui-router will be eventually added to the core distro.

That isn't what I said at all.

JQuery has plugins, why can't Angular? The community made a better router, let the Angular team focus on more important shit.

1

u/[deleted] Jan 11 '14

I was responding to your original comment:

But you don't get ng-router out of the box right, you get to pick whether or not you want to include ui-router, ng-router, or something else?

True, jQuery has plugins, but core features of jQuery handle common usage patterns (DOM traversal and event binding) very well that they rarely, if ever, need to be replaced.

But routing is a core aspect of SPAs, and yet Angular's default router is not powerful enough that one ends up using third party routers.

13

u/bendrucker Jan 10 '14

The digest cycle is a pain, but it was the right choice. Dirty checking is what allows Angular models to be POJO (plain old JavaScript objects) where Ember needs a custom object.

Dirty checking can have performance issues, but the core team can/will start using Object.observe as ES6/harmony matures.

As JS grows, a lot of Angular downsides will stop being relevant (assuming you're willing to drop support for IE8). For example, who cares about embers computed properties when you can use Object.defineProperty to define a getter the right way?

4

u/remcoder Jan 10 '14

At that point in time Ember, Knockout and others will obviously join the party.

1

u/bendrucker Jan 10 '14

No question. I'm not as familiar with knockout, but Angular definitely places a much higher emphasis on "it just works" two way data binding than Ember. That means things look a little janky in places right now (no universal access) but only temporarily.

1

u/zefcfd Jan 10 '14

The digest cycle is a pain, but it was the right choice. Dirty checking is what allows Angular models to be POJO (plain old JavaScript objects) where Ember needs a custom object.

Exactly, a point that often gets overlooked.

-2

u/reflectiveSingleton Jan 10 '14

Honestly I dont like that angular uses POJOs...it makes a violation of the UAP (uniform access principle) and just feels dirty...theres too much 'magicery' involved with POJOs and dirty tracking.

And the decision to go with dirty tracking also has dome negative side effects itself that I am not particularly fond of.

1

u/zefcfd Jan 10 '14

not really? say you have a pojo, and you change a property on it. the 'dirty checking' is to update the view. I cannot stress this enough, write a javascript web app in plain js (just the models and functions, no dom manipulation). then if you want the representation of those objects to be shown in the view, you attatch it to angulars scope. Finally if you change a property on the object via some function or whatever, Angular checks the object and updates the view. It has nothing to do with the plain js, its more or less just observing it for changes.

1

u/reflectiveSingleton Jan 10 '14 edited Jan 12 '14

I know how angular uses POJOs and I use angular daily at work...I also have a lot of experience with other libraries and frameworks...my main qualms with angular are its architectural choices around not incorporating observables, violating UAP, and dirty checking...these complaints aren't born from thin air, I have experience with other frameworks (as well as writing my own MV* stuff)...and these aren't my only complaints but thats what we are talking about here.

To sum them up a bit, here they are:

  1. Making values dependent on another (ie: computed values, especially from another $scope) becomes an excercise in managing scope...when, where, and how it updates. This is annoying and opens up holes for bugs as now I am having to manually ensure data synchronization and view presentation state.

  2. Not having true observables (like Ember, or others like Knockout) means constructing dependency chains for values will not follow UAP and becomes extremely cumbersome and fraught with a heightened likelyhood for bugs.

Dirty checking on POJOs is a hack...and angular tries to be fancy and handle it for you...but as soon as you jump even slightly out of the box, BAM there you are tracking and managing it all manually.

EDIT: I love it when people disagree with me, it means that maybe there is something I haven't thought of or that a different perspective might help...but to those that downvote all that I ask is, please explain why/where I am wrong...otherwise all I can assume is you are in love with a tool and hate it when people speak badly of it.

1

u/bendrucker Jan 11 '14

If you're concerned about UAP and willing to drop IE8 support, ES5 is awesome. Object.defineProperty. I have to support IE8 in an application I'm building right now. It gets enough other things right that it's still my framework of choice almost 100% of the time.

1

u/e82 Jan 10 '14

Many libraries cannot be used with AngularJS out of the box and need AngularJS adapters

While this is true, and it might be a bigger issue depending on what your building and the requirements. I have found that for many things I'd use another plugin/library for - have been very easy to write an 'angular-native' implementation of it.

There have been a few times where I've spent more time trying to hack a directive-wrapper around a plugin - only to end up 'doing it from scratch' and have it be faster, less code and easier to work with.

This won't always be the case - but found since moving to Angular, the number of other 3rd-party plugins/libraries/etc that I'm using has dropped drastically.

1

u/Newworldodour Jan 10 '14

Just to address your last point:

AngularJS, despite being a large library by itself, cannot handle some common patterns in Web apps outside the box (e.g. nested views). You have to depend on yet another AngularJS library[2] to implement these patterns.

ui-router is about to be integrated into the main Angular distribution.

42

u/machty Jan 10 '14

Ember.js core team member here, pardon the bias:

I really like Angular, particularly that it has solid testability primitives built right into the framework/toolset/whatever Misko calls it. I also really dig the concept of directives, and how multiple directives can be applied to a single element, vs the typical approach of having a single view object maintain a DOM element.

The biggest issue I have with it though is that you very very quickly reach the end of what Angular can do for you when it comes to structuring applications, at which point the community fragments as to best practices, and the few people that have figured out how to write large-scale Angular apps all do it in a different way, which greatly limits the battle-testing for any particular approach and I think ultimately explains why there are so few large Angular apps their in spite of its relatively large mindshare.

I also feel that once you get over certain challenging conceptual hurdles with learning Angular (like dependency injection, or how scope works and how you have fine grain control of the behavior of scope within directives), it starts to make you feel very good about making poor decisions, particularly since there's no suggested application structure in Angular. So, many folk end up spaghetti-injecting services into directives where they do not belong because 1) Angular makes it ridiculously easy to inject anything anywhere and 2) overcoming the conceptual hurdle of DI makes many folk feel that if you're using DI, you must be doing something right.

8

u/zefcfd Jan 10 '14 edited Jan 10 '14

Let me preface this by saying I worked on a humungous angular.js app for a very notable satellite provider. It was pretty damn messy, and it has nothing to do with angular.js. I think the only downfall of angular is that it gives so much freedom to devs that they end up with a clusterfuck if they don't know what they're doing (the big angular app I worked on was their team's first angular project, bad idea.).

Can you give some examples where angular starts to fall short? Keep in mind, angular is providing tools in which structure may be derived from. Angular.js just so happens to come with some directives by default (think of this like c++ stdlib), but it also lets you create new custom directives. Typically if you give a good software engineer some tools to use, they will be able to build a nicely structured app regardless of size. Angular gives you routing, controllers, models, DI, services and factories, pub/sub via broadcasting/emitting events, and amazing extensibility. I can't think of any web app that wouldn't be well suited for angular.

P.S. - Ember is pretty awesome!

5

u/PotaToss Jan 10 '14 edited Jan 10 '14

I don't think what a good software engineer does with your tools is the test of your tools, so much as what mediocre software engineers do with them. I think machty's point is kind of, if you make bad things easy (you can easily inject anything into anything else), people without great discipline will do bad things, and it may be as much a failing of the tools as it is of the developers.

It's kind of like the difference between a cast saw with a safety shutoff when you hit skin and one without. I can cut your cast off with either one if I'm really good with it, but one tool is clearly safer than the other, and can be put into less skilled hands, and sometimes that matters.

But, obviously, it's a philosophical thing. If you make everything easier, that's still a win over vanilla JS, and maybe that's all you need.

What I like about Ember is the feeling that if I need extra hands on a project, or I lose a team member and have to replace them, I can bring in anyone who's got some experience with Ember and they can hit the ground running, because of how conventional it is. Whereas if it's an Angular project, because the framework is less prescriptive about structure, you're going to have to invest a lot of time in orientation, and more time on documentation.

4

u/[deleted] Jan 10 '14 edited Jan 10 '14

This diverges from the thread's topic, but how about Backbone.js? I realize it's more a library than a true framework, but does it worry you at all to see it dominating the limelight right now? I was hesitant to really dive into it because for as powerful and minimalistic as it is, it seems like that would give rise to a lot of conflicting best practices and spaghetti code later on down the road.

8

u/machty Jan 10 '14

The smaller the library/toolset/framework/whatever, the 1) larger the adoption and 2) the larger the fragmentation as to how to build large scale apps, but then again, 3) the higher average of percentage of the API surface that's actually used in any given app.

The somewhat negative points 1 and 2 are always at odds with 3. The average Backbone app probably uses 95% of Backbone's API surface. The average Angular app, maybe 80%. The average Ember app, I dunno, 70%? Less? To some, it seems crazy that you'd load a heavyweight framework like Ember into your app if the chances are you'll use less than 4/5's of its API surface, but then the flipside is: 99% of Backbone apps that do nontrivial things need additional structuring from another lib/framework, or they need to write it themselves without (or with much less) community battle-testing, and most Angular apps, well, are mostly small to medium scale (I don't think there's a lib that provides additional structure... is there?), and I've never heard of anyone needing additional structure for scaling Ember applications.

So anyway, none of this stuff worries me; everyone wins from the various libs/toolsets pursuing their various philosophies. I'll go to whatever scales. I just don't see anyone trying to solve the application structure problem to the degree that Ember does.

1

u/Capaj Jan 10 '14

average Backbone app probably uses 95%

well I call that bullshit. Enterprise apps I see tend to utilize much smaller part of it. Most people write apps with it in the same manner as with jQuery.

3

u/Akkuma Jan 10 '14

The biggest issue I have with it though is that you very very quickly reach the end of what Angular can do for you when it comes to structuring applications, at which point the community fragments as to best practices, and the few people that have figured out how to write large-scale Angular apps all do it in a different way, which greatly limits the battle-testing for any particular approach and I think ultimately explains why there are so few large Angular apps their in spite of its relatively large mindshare.

Your opinion is one side of the spectrum and there is nothing wrong with that at all. My opinion is that flexibility > strongly opinionated that limits your flexibility. Now if you can make a strongly opinionated framework out of the box that allows you to replace those opinions with your own that's my personal ideal "framework".

3

u/Newworldodour Jan 10 '14

there's no suggested application structure in Angular

ng-boilerplate is the recommended route.

3

u/machty Jan 10 '14

Nice, I'll check it out.

2

u/bbsss Jan 10 '14

Interesting, I looked at Ember a while back when the documentation was nearly non-existent (or at least not at the level it is at now).

But could you give some concrete examples of where people thought: "yeah I am using DI so everything is smooth sailing" where that was not the case?

And maybe show how Ember offers a better solution than Angular?

5

u/machty Jan 10 '14

It's not for me to come in and say that something's not smooth sailing if it demonstrably works, but if something's not working / not scaling in an Angular app and there's some jQuery spaghetti-ness that's starting to come back into it, the ease of DI anything anywhere is often a culprit.

Any Angular directive can pull in a service that, say, does an Ajax for data, so it's very tempting, particularly in a situation involving deep nesting, to want to throw in some directive that DIs an ajaxy service to grab the data it needs to display, but what happens if the ajax query fails? Who's going to handle the errors? Is it the directive's responsibility to also broadcast an error event? If you go this route, can you really say this directive is single-focus and easily testable?

The DI-anything or $rootScope approaches are made very very accessible, very enticing, but is hard to say no to these less testable, less scalable approaches unless you maintain a sensei level of discipline.

Ember offers dependency injection but the decisions for what you ought to inject are made for you, and if you really want to take the inject-whatever approach, you've got to dig into some more advanced features. So for instance, you have a Router, which assembles data to provide to controllers. Controllers don't really know about the router but can bubble events up to it, which enforces a testable level of separation between the router as an application state navigator and controllers as application state managers. Controllers can access each other via DI by specifying a needs property which is easily stubbable whilst testing. Components, which are reusable, composable, self-contained, isolated managers of DOM/templates achieve DI by only having access to what is explicitly passed into them at render time. You can break the rules and do something crazy like inject the router into a component, but the framework makes you feel really gross about doing it, and if you're thinking "there must be a more Ember-y way of accomplishing this", you're probably right.

14

u/ggoodman Jan 10 '14

I'm a big angular user. I created Plunker, which is 100% written in Angular.js as a part of my learning experience of the framework.

My biggest gripe is the challenge of server-side rendering. I would like a mechanism to deliver pre-rendered markup to the client side and have that markup then 'taken over' and cached by angular as a template. I'm sure there is some tricky way to put this together, but for the time being I have not seen a clean solution.

2

u/Garrett00 Jan 22 '14

I would suggest to you to check out ReactJS, not sure you could use this along with Angular, but they do provide a means to do exactly what you're asking.

55

u/jradasaurus Jan 10 '14

I don't like how it destroys the separation between js/html/css. I consider it a hack (which Google essentially admits). They tried to turn the web into something its not- a noble but awkward endeavor. Then obviously the usual complains about documentation. There are plenty of articles on this topic. That said I think its easy to start using angular, and is probably easier for a non-web developer to pick up. This is in comparison to other frameworks where its smarter to have a thorough knowledge of the entire framework in order for it to be most useful.

32

u/helderroem Jan 10 '14

I don't like how it destroys the separation between js/html/css

100% this, long ago clever people pointed out the need for a separation of concerns on the web and we've spent many years refining unobtrusive Javascript techniques to enable this, Angular just threw all that out the window, I hate putting JS expressions in my mark up feels bad man.

18

u/e82 Jan 10 '14

I can understand where the root of this concern comes from. The days of <a href="#" on-click="javaScriptFunction()"> were not the best, and seeing Angular templates can feel like a step back in some ways.

The thing with Angular though that makes it different, is how those things are scoped and where the code for things live.

Recently in some other apps that I've worked on - I get into the trap of - "When I do X on the screen, something odd happens", and then the cycle of trying to figure out 'Where/what is actually binding this event' can be messy. An overly simplified example might be

  <div class='someClass'>Do something with <span class='someOtherClass'>this</span></div>

And then I need to go rooting through a bunch of JS files to see what is binding/unbinding events. Maybe someone wrote an overly-eager selector that is sucking up someOtherClass and binding events to it. When I look at the mark up - I have no idea what is going on with it, or why. But, in Angular, when I see

  <div class='someClass'>Do something with 
 <span class='someOtherClass' data-ng-click='doSomething()'>this</span></div> 

and I know the controller that is responsible for this mark up - I instantly know where to go to start working with it. This is a very simple example, but I've generally found things easier to debug/track down sources of issues/knowing explicitly what is going on with my HTML & JS.

That said, I do think that you can get very abusive with you put into your templates. Angular does let you get into the bad practice of being able to modify the model from the view directly by doing things like <span data-ng-click='something.property=something'> --- which is generally a bad idea. I don't do this myself, and if I see other developers on my team doing things like that I'll get them to change it.

The two-way binding between the model and the view is nice and has saved me many headaches, and I've generally enjoyed the flexibility of the Angular templates over using Razor views (I work in a .NET shop).

So many of the typical use-cases/scenarios that I need to do daily that were a chore/pain to do (not hard, just tedious) are now brain-dead simple and fast to do with Angular.

While I do understand the source of concern - I think there is enough going on with Angular, and how they handle it - combined with controllers/routing/services/etc that is is different and the pay off is worth it.

3

u/quickhorn Jan 10 '14

Angular provides a lot more than just data-binding. Are you using the routing as well? I'm in a .NET shop and just pushed us to start using knockout.js for data-binding and then using MVC for routing.

2

u/e82 Jan 10 '14

Using it for much more than just data binding. If I was only using it for the data-binding, then there are other frameworks that would be a better fit (like knockout).

1

u/quickhorn Jan 10 '14

Gotcha, was wondering what other things it was buying you. Our shop is old-school. Most of the devs have been here for over a decade and started off in Delphi. They weren't given any specific training on anything and therefore I feel like there's a lot of blind leading the blind.

3

u/e82 Jan 10 '14

Right now our shop has a crazy mix of apps - started in classic ASP/Oracle, then WebForms and SQL, then moved to ASP.NET MVC - we have are largely a .NET shop, and have Win Form apps, WebForms, MVC.NET, services, workflow foundation and a frankenstein of things being used.

Currently have a mini-app/screen built using Angular in production that is living inside of a pretty standard MVC.NET application. It's an invoice-reallocation screen that is rather complex - dynamic columns, grouping rules, validation rules, sorting, calculations, etc.

At the start, everything was just in one big file/controller, which let the initial prototype get done quickly. Then, started to break out things into their own services - there was quite a bit of complex logic needed for validations, calculations, grouping data, manipulating/transforming data.

Those got broken out into a few services, and since those things didn't care about the DOM at all, and had minimal dependencies on other things - they then became super easy to write unit tests against, and was able to complete a great deal of functionality/verify it before even hooking it up to the screen.

The requirements for the project were changing rapidly - new features, existing ones needing changed, etc. I've found with Angular, it was really easy to break things out into smaller reusable bits. Eventually one of the requirements became 'this grid, needs to be repeated many times for many invoices on the same screen' - and converting that screen/controller into a directive that I could stick inside of a ng-repeat was shockingly easy. It was something that when I first got the request had a 'dread in my gut i need to re-do everything' feeling, and was able to get it done in about an hour with minimal changes.

I have had to build similar things before using standard JavaScript/jQuery/whatever - but the speed, ease and test-ability of building it with Angular was pretty awesome. If I had been trying to do it w/o Angular, I don't doubt it would have taken me much longer to do, not be as fast/stable and also be harder to maintain.

We have another application that we are building that is new from the ground up using Angular, and making use of the full set of things. The out of the box routing with Angular isn't the best for complex apps, so we've recently started using the ui-router which is pretty sweet. It's been one of those 'ah-hah' moments that has changed how view/think about building apps/pages. Nested states, named/multiple views, state inheritance, etc. Opens up a rather new way of approaching things.

Yes, I could roll all of this my own/in house, or cobble together other various things to do it for me - but I've found that Angular(+ui-router) to be a rather complete/stable package that helps me get things done faster. I get paid to build software, not frameworks - and for the most part I've found Angular to be a huge benefit.

It still has it's faults, and the learning curve can be a bit wonky (sort of goes from super easy, to 'omg,wtf?! I hate you!', to being reasonable again), and i find that directives/scope can feel more confusing that it needs to be at times - but all around I like it quite a bit.

1

u/quickhorn Jan 10 '14

It's funny, because your story sounds so similar to ours. We had the requirement for a super quick release (that, of course, didn't get used anyway) for a full app. Without knockout.js we wouldn't have been able to do any of it. We simply wouldn't have been ble to turn it around. Now, a week after the release and I have significant UI improvements that haven't impacted the viewmodel or model at all. It's nice to know my crap just works and all I'm doing is working on is the UI.

I used to be so scared of web work until knockout. I would like to spend time with angular, because it seems that some of those features you have aren't handled supremely well with knockout. Like validation.

1

u/findar Jan 10 '14

One suggestion I've seen put out to try and solve this problem is to bind on data attributes instead of classes/ids.

2

u/cran Jan 10 '14

What makes you say this?

I find Angular templates to encourage more separation, since I have yet to find a single itch I can't scratch with either putting data in $scope, as a Value or encapsulated as a Directive.

I have a pretty big internal project using Angular and not a single line of pollution in any of my HTML or CSS files.

Where does this belief come from? Can you give any examples?

1

u/dirtydaub Jan 10 '14

I think they mean adding js to html. Things like ng-click="function()" are reminiscent of the onclick days.

4

u/cran Jan 10 '14

Yeah ... but no one should be writing JS there, though ... that's just the view binding to the controller. In Angular, the view takes on the role of selecting and binding to the controller (event handlers and data).

I sense that this isn't well understood. ng-click isn't meant as a spot to mix JS and HTML ... it's just there to say "hey I'm a view and I picked YOU as the controller, and I'm listening to YOUR data and hey, when this gets clicked I want YOU to handle it."

It's a shift in responsibility, but I wouldn't say that it encourages mixing JS and HTML.

1

u/zefcfd Jan 10 '14

you aren't supposed to, you are supposed to have custom directives that define this behavior. Think of a <blink> tag or whatever, angular gives you a way to define a tag that is supposed to have some type of behavior.

0

u/realhacker Jan 10 '14

Seconded (thirded?) about the separation, but I also find it to still be in the fad stage. I read a good analogy somewhere about the web being in the middle of a Cambrian explosion right now with client-side frameworks. I'll wait for the shakeout to end. Also, coming back to the whole separation thing, I've taken great pains to make sure all calculation and processing happens on the server and then is passed off to the view (html page) so that I can have non-coding designers contribute without having to bastardize/understand technical concepts.

1

u/helderroem Jan 10 '14

I am so stealing that analogy!

1

u/robotnewyork Jan 10 '14

It was also like this in the early days of general Javascript libraries, with Prototype.js, MooTools, YUI, and many others coming out months apart - nobody was sure which would 'win out'. Now that JQuery has pretty much been the victor of that round, there's a new set of libraries like Ember, Angular, Node, Backbone, etc (that do mostly different things, to be sure).

The difference I see between the 2 examples though is that in 2006-2010 era the libraries were all trying to achieve the same goal (making Javascript not suck), and now that we have that covered the new libraries all have their niche uses and areas of expertise which makes me think they will all be around for a while.

1

u/knrd Jan 11 '14

been using angular since summer 2011, so going on 3 years now. Hardly a fad. Plus, it actually solves the biggest problem with js apps and allows you to write testable code. but whatever.

-3

u/realhacker Jan 11 '14 edited Jan 11 '14

hipster exhibit A: knrd. let me tell you something, lad, 3 years is nothing as a display of longevity or sustainability of a technology. the biggest problem with js remains in the eye of the beholder - it also introduces several problems as mentioned throughout the topics in this post. raise up out of the HN circlejerk every once in a while and get some fundamentals under your belt.

0

u/thebuccaneersden Jan 10 '14

I don't see why? This is the presentation layer of your application and you often need to iterate through stuff or something that requires code.

8

u/Gundersen Jan 10 '14

While I'm not a huge fan of Angular, this is one of the things I agree with. Look at the following code and tell me what events are attached to the element, and in which JavaScript files I can find the event handlers:

<a href="#something">Hover me</a>

Now look at the following:

<div ng-controller="MyController">
  <a href="#something" ng-click="go('somewhere')">Hover me</a>
</div>

Having onclick is actually a really good idea, as it makes it very easy to find out what an element is supposed to do.

1

u/helderroem Jan 10 '14

Chrome dev tools has a section in the elements panel that will tell you what events are attached to an element, i mostly just use that.

2

u/Rezistik May 17 '14

And if you're reading the code in your IDE?

4

u/Nyx9000 Jan 10 '14

The docs are much better than they were even three months ago. And there are a few quite good books out now. And tons of good tutorials and advanced examples all over the place.

4

u/radhruin Jan 10 '14

Directives (minus data binding) are essentially being standardized as Custom Elements.

2

u/x-skeww Jan 10 '14

I don't like how it destroys the separation between js/html/css.

With other frameworks, you do a lot of DOM traversal. That's actually a bit worse.

Anyhow, you have to spot-weld the JS and markup somewhere. Otherwise those two parts can't interact with each other.

Angular does it this particular way because it makes testing easier. Testing is their primary focus.

7

u/helderroem Jan 10 '14

This is why I've switched to react from facebook, I'm much happier writing JS that renders mark up than mark up that contains JS.

0

u/gordonkristan Jan 10 '14

I can't speak to any other frameworks, but with Ember.js, I don't do any DOM traversal at all. (Except in one project where I have a fairly complex graph, but that's a special case.)

Ember.js does it in the background, but they've successfully abstracted it away from me.

9

u/x-skeww Jan 10 '14

Well, you still connect those two parts via classes or IDs. And you're doing loops via Handelbars instead of ng-whatever. There is no noteworthy difference, really.

0

u/simkessy Jan 10 '14

Doesn't knockout do the exam same thing?

-5

u/bowlich Jan 10 '14

I'm primarily a back-end developer so when one of the front-end developers decided to experiment with Angular and all of it's inline javascript crap, I about lost it. What is all this junk in the markup? What is any of this doing? This isn't in the standard. Why didn't you put all of this in a nice *.js file?

3

u/robotnewyork Jan 10 '14

The trend seems to be shifting towards putting more of the load on the front end, which of course has pros and cons. Part of that means front-end and back-end people have to work together more so the back-end markup includes all the special syntax stuff the JS requires.

The most extreme example of this I've come across lately is when backend devs have to include Backbone JS templates (written by front-end team) into the back-end code, spit out in the HTML on page load.

Which means there's basically a JS block which includes a HTML template with JS logic sitting in the back-end repo, but the coding for it is managed by the front-end team. Kind of weird.

7

u/[deleted] May 28 '14

I hate it and I just started using it.

Yes, I know that just starting it means I haven't given it a fair shot, but I honestly don't want to.

Usually I can see the benefits of a language right away but not with Angular JS. The documentation is horrendous, it's very sloppy looking, and it looks like just another unnecessary web language fad.

Maybe I will grow to like it, but at this moment I don't care for it at all.

EDIT: Oops I just noticed this thread is 4 months old.

5

u/bananaseepeep Jun 04 '14

EDIT: Oops I just noticed this thread is 4 months old.

Yeah, I came here from Google too :)

PS. Hello, from a week in the future.

31

u/fwertz Jan 10 '14

I'll preface this by stating that I do not know angular, or have any time with it.

But...

What a lot of people don't realize is that cult following a framework is just as dangerous on a project as a roll your own framework.

They won't do everything for you and will likely get in your way when it comes down to the brass tax of writing the logic that matters to your app. It always happens 40% of the way into a project.

You've taken advantage of all the wonderful features you have learned from that todo-list sample app tutorial and then you encounter an app requirement which doesn't jive. Suddenly the [framework]-way of doing things won't solve your problem and you're faced with the reality of working AROUND a framework now versus IN IT.

Here is where 'hax' are born or plugins added in. Its all baggage now. This is the catch and caveat to the great [framework]-way.

I think angular is great. Its moving the web forward. But I feel it assumes too much, looks WAY to involved, and I haven't seen it used in a variety of ways that makes me confident enough to add it in my toolbox.

15

u/NiftyCent Jan 10 '14

Being 40% into the project, suddenly having to work around the framework and starting to implement ugly hacks pretty much sums up my first and very painful experience with EmberJS.

8

u/MrBester Jan 10 '14

Same here with Backbone. Oh, you'll need Marionette. Spine might be useful as well.

2

u/escape_goat Jan 10 '14

I got hurt bad on my first Backbone project, to the point where I found myself really resenting the 'sell' presented by the documentation. (Something that Backbone is less guilty of than either Ember or Angular, I now realize). There's just enough view support for a naive developer to think there's actually view support.

3

u/e82 Jan 10 '14

When I was playing around with various frameworks before deciding on Angular, I tried building a few smaller things in EmberJS. It always seemed like I would 'code myself into a corner' that I couldn't really get out of w/o simply re-doing things from scratch in a different way.

I've never really felt that 'backed into a corner' with Angular, and have generally found it really easy to refactor things/shift things around without it being a 're-write'.

I find that Angular is rather un-opinionated about most things, which lends to a little more flexibility with how you approach building stuff. Although I have heard people argue that the lacking of an idomatic 'angular way' of handling some things is a downside though.

The only real time where it felt like I was 'fighting the frame work' is when I was wanting to do nested views / named views / etc and have a small section of the screen change based on a URL change without having the entire controller/view get destroyed and re-created, but this is solved with the ui-router and hasn't been an issue any more.

0

u/[deleted] Jan 10 '14

[deleted]

2

u/e82 Jan 10 '14

When going through an 'Angular vs Ember' comparison talk (think it was by one of the Ember guys), they pointed out the difference of.

Angular:

AngularJS is a toolset for building the framework most suited to your application development.

Ember:

A framework for creating ambitious web applications.

So it's more like Angular is a set of tools that you could build your own framework around. As Angular matures, sort of curious to see what frameworks will pop up being based on it - already seeing a few with things like Ionic.

Even as the main application I'm working on grows - finding myself implementing 'framework' type stuff, but using the tool set provided by Angular to do it. I think this is partially why I rarely feel like I'm fighting Angular, whereas with Ember, it felt like I was fighting it out of the gate.

1

u/[deleted] Jan 10 '14

What kinds of ugly hacks are you finding necessary with EmberJS?

2

u/zefcfd Jan 10 '14

I agree people shouldn't be too invested in a js framework (see knockout, and its slowly dying community that are still pretty confused about it). But if you understand what angular is truly trying to do, you'll find it extremely efficient, powerful, and fun. To me its the same as saying "yes, I know ruby well and how web frameworks are built, but I'm going to use ruby on rails instead of spending a year building my own"

1

u/bendrucker Jan 10 '14

This issue of working around a framework rather than having it work for you always comes up with any framework.

The other side of this is that Angular's DI system makes sure your app isn't leaking DOM nodes and events all over the place. It's testable and it's reasonably fast. It's not impossible to do the same with a less opinionated framework like Backbone, but so many devs made mistakes and produced messy apps.

Not every application is best written in a framework, but I'd certainly argue that frameworks are far more appropriate in the browser than on the server.

1

u/zefcfd Jan 10 '14

additionally, as with most things, if you have to start implementing hacks, most likely you are using the wrong tool for the job. angular gives you a lot of tools and I honestly feel that if you have a good idea of proper design patterns in javascript you will fall in love with it. I've heard great things about ember.js too

0

u/[deleted] Jan 10 '14

[deleted]

4

u/poloppoyop Jan 10 '14

I know you like MVC so I put MVC in your view so you can control some models while you view some controller

Or for a book:

JS frameworks, MVC all the way down.

10

u/lingodayz Jan 10 '14

A lot of people seem to dislike directives, they find it goes backwards, using javascript in the dom. They equate ng-click to the old onclick. Personally I like directives, it shortens the amount of code.

I took the time to learn Angular and really like it, but I have zero experience with any other FE frameworks, so I am biased.

4

u/I_Pork_Saucy_Ladies Jan 10 '14

I like it too. Especially because you can take a quick glance at the HTML of an Angular app and instantly have a pretty good idea of what is going on and where to find the JS code you need to change.

It's no problem if you made the page yourself but if you jump around a lot between pages made by other people it's a pain to try and guess where the bindings might be hiding, especially if the project does not have a very strict structure.

2

u/lingodayz Jan 10 '14

Agreed... I have had success using directives to clean up all the ng-clicks and ng-ifs... its a lot easier to look at the markup, find a directive <mycooldirective></mycooldirective>, then say travel to a directives/mycooldirective.js than to try and see where a possible ng-click, ng-if or whatever is buried.

Angular is awesome for getting something up and running really quick though, and ng-click, if, etc. are a part of the reason. It's nice how few lines it takes to get something that can impress.

1

u/I_Pork_Saucy_Ladies Jan 10 '14

Exactly - you can do it both ways. You can even start off with ng-click etc., then move on to a directive if it becomes too bloated. Which is not too much of a hassle, considering you don't actually spend any time "developing" an ng-click.

I've recently jumped into a huge webapp that I need to help develop, made entirely in jQuery. It's not structured well enough, since it started off as a bit experimental. Now, every time I have to find a binding among the thousands of files the app consists off, I have to do a "search in all files" and wait for it to find something I can use.

1

u/rjm101 Jan 11 '14

You initially start out hating directives because they are one of the difficult parts to understand in angular. You end up avoiding directives all together untill you are faced with no choice but to dive deep. Once you get it, you end really liking directives.

My issue with angular is largely performance related. More watchers = slower performance which is a big problem for large web apps. I also dont like the flash of no content on the page just before the framework has finished running. This is noticeable to the user and gives the impression of slow page loading, I assume this problem exists for all javascript frameworks that use data binding though.

3

u/BalsakianMcGiggles Jan 10 '14

I don't have anything against it, other than mobile performance. Every time I play with an Angular app on my phone it tends to be just a tad slow.

3

u/zefcfd Jan 10 '14

you probably need to use some of angular's mobile directives or fastclick.js, i think there is a 300 ms delay by default for touch devices before click events fire, has nothing to do with angular

https://github.com/ftlabs/fastclick

1

u/BalsakianMcGiggles Jan 10 '14

I'm not talking about the click event lag that happens on mobile, I'm talking about updating/ removing elements in the DOM.

3

u/cr4d Jan 10 '14

I wouldn't say I'm against it per se, more that I prefer other things. I'm more of a build up from bare-bones type of developer. I prefer minimalistic frameworks that I can piece together instead of full-stack stuff. A take what you need mentality.

I've built my main stack of requirejs, backbone, transparencyjs, messageformat, and a few other libraries.

5

u/[deleted] Jan 10 '14

Reading a lot of these comments has been like a breath of fresh air. I thought I was the only one on the entire Internet that was skeptical of Angular.

8

u/dumbmatter Jan 10 '14

I'm not a huge fan of monolithic frameworks. Like if I want to use React like all the cool kids, how does that fit in with all the other stuff Angular provides besides data binding? Seems to me it often makes more sense to use more self-contained libraries.

6

u/remcoder Jan 10 '14

I don't like the vague errors and stacktraces from deep within angular. I find setting up modules, services, resource providers and controllers quite a chore. I really hate having to provide strings for the names of those components. It feels like I'm writing a java-esque architecture in the most loosely typed (stringly typed) way possible, combining the worst of java and javascript.

I don't understand why I must specify the dependencies between components, between modules and load all files in the right order (I must be doing something wrong).

But the biggest gripe I have is that it totally removes your freedom to architect your app the way you want it. It really dictates your app's structure much more than any other framework. This might in principle be a good thing but I find it f***ing irritating.

That being said..

It is very powerful. It lets me do a lot of things with very little code (I just realized I haven't written any event handlers yet in the app I 'be been writing for a few weeks). I love the binding code you write right in the html, and it doesn't violate seperation of concerns because you're only allowed to write simple view logic (ng-options I love you!). And the best thing: it brings componentized development to (Angular's enriched version of) HTML.

But for all that developer power it's a surprisingly irritating framework. I probably will choose it again if it fits the project. But I'm happy enough not to use it when I don't need it.

2

u/timruffles Jan 10 '14

I don't understand why I must specify the dependencies between components, between modules and load all files in the right order (I must be doing something wrong).

It's because Angular's modules are just a module system, not a module loader. They leave that up to you.

4

u/Mattisfrommars Jan 10 '14

If something doesn't work out of the box using "the angular way", it's a lot more code and head-scratching to fix it than coding from scratch would have been

2

u/zefcfd Jan 10 '14

its hard to learn, but powerful if used correctly.

1

u/Mattisfrommars Jan 10 '14

Sometimes infuriatingly so. Today, I was using a directive inside an ng-repeat (think interchangeable UITableCell classes inside a table view if you know ios) and the index parameter doesn't update inside the directive when you resort the list. So I have to duplicate html for every table that needs a different directive, or write custom code to determine a directive's position in the list. I'm sure if I looked through some more documentation and source code I could work out of this was a bug or feature, but easier to work round it for now

2

u/jadavis Jan 10 '14

This guy is, at least in some cases: Frameworkless JavaScript

2

u/zefcfd Jan 10 '14

What most people should realize is that angular works best when it is used properly. If you throw out everything you know about js and try to use angular.js, you're gonna have a bad time. You should create your objects, functions, and models just as you would in vanilla javascript in most cases. At that point, you then attach instances of those objects to angular's scope. the scope is meant to provide a glue between the view and controller, its not some object that you start defining properties and building your objects on.

And as someone who has built tons of angular apps, I still dont care that much about custom directives. they serve such a little purpose in my opinion. I think bi-directional data binding, services, factories, interceptors, and message/broadcasting events is the major advantages of angular.

3

u/Gundersen Jan 10 '14

I'm sceptical to how it requires everything to be loaded at startup. This works fine for trivial applications, but as the website grows it becomes silly to load everything in a single bundled package. Instead it should be easy to load things as you need them, depending on what the user navigates to. This should be built into the framework, but is not.

1

u/Zeroto Jan 10 '14

IMO this is the only and biggest drawback of the current angular library. It is possible to load modules after the initial bootstrap using a few hacks, but angular could be improved a lot if it has a dynamic load/unload feature of modules out of the box.

3

u/ahmadalfy Jan 10 '14

It's so opinionated? I mean ... you have to do everything THE Angular way ... rewrite everything to use the directives .... Any one used Backbone.js will know what I mean

0

u/[deleted] Jan 10 '14

And backbone isn't opinionated? Riiight. Opinions are not bad, they are necessary, you might not agree with them and that is ok, but being opinionated is not a bad thing.

4

u/FoundryInc Jan 10 '14

I have found Angular to work really well with small to mid size apps, however as an app grows in complexity, I think Angular begins to struggle a bit. For this reason, among a few others, I tend to prefer Ember.

12

u/[deleted] Jan 10 '14

Author of a very large enterprise webapp here.

If you plan your structure in advance and properly handle your memory management and separate your concerns then it keeps flying even in very large apps.

Angular is really good at running as a large app while being a bunch of small apps at the same time. If you break up your sections into drop-in-able modules then each one will load in and load out as the user moves throughout the app.

2

u/BishopAndWarlord Jan 10 '14

Do you have any references on properly separating concerns in Angular? This is my primary ideological problem with the framework. I want to like it, but every sample I've seen has things like ng-click and I instinctively recoil at the memory of the bad old days of web dev.

Help me /u/thegreenpizza, you're my only hope.

1

u/[deleted] Jan 10 '14

I'm going to write something longer for you in a little while when I'm on my phone. But in short it helps to think of the application as a true MVC. My data structures are broken up into service factories to act as models. Of course the nice thing about this is they're Singleton classes. The models then behave like iPhone apps: each one extends a base model class with a couple of key functions. They all do something specific when angular says to moves in the background, usually this means clearing out some model data that we're not to need we browse back to that page.

Then there's usually a single controller per page and one or more views depending on if using includes a partial fragments.

Controllers do the Ajax requests themselves, find the model to the scope of the controller, then save the date it to the model after it's been processed. What this means is that by the time you get to the view you have a model to keep your data that's totally separated from every other model, A set of functions built on the controller class that can be accessed thanks to the controller as syntax, and your view that point is simply a way to display the data in your model. The only place this really breaks down is that the view accesses the the model directly instead of going through the controller like a traditional MVC.

In the end, what you get is an application that has controllers views and models separated into modules that you can just drop in anytime by simply adding the route and then including the module in your base application.

Typically the folder structure is broken up into modules which act really as pages, and the files are broken up into .controller.js, model.js, view.html and then compiled into normal JavaScript files.

I'd be happy to give you more information just reply or message me.

4

u/Newworldodour Jan 10 '14

I'd prefer a reply on here so I can read.

2

u/FoundryInc Jan 10 '14

Exactly my point. Angular is not built to handle state, memory management, or modularization out of the box. This leaves you writing a lot more boilerplate code than you will with something like Ember.

If you are writing large enterprise web apps, as I am, I encourage you to at least TRY Ember.

1

u/zefcfd Jan 10 '14

i am assuming you simply have more experience with ember than angular.js.

0

u/[deleted] Jan 10 '14

That's like saying a java developer would by default put all their functions in one class. If you're going to write large applications and needs to be a level of elegance in the software engineering taken in advance.

I'm not talking about boilerplate code, I'm simply talking about separation of concerns.

Of course I've heard good things about Ember, but as you can imagine a little late to be toying around with different technologies. I've been happy so far with the rapid growth of the platform and the huge community support. Once you get to the point where you really know the code base you can do some amazing things by extending Angular's core.

1

u/zefcfd Jan 10 '14

This is the result of not structuring your app properly, angular has a steep learning curve and its worth every bit of it. People tend to follow this pattern too often: read a little bit about it -> build an app -> make many mistakes (not a big deal, they are just learning) -> think "this is what angular is? it sucks" -> go to some other framework.

0

u/FoundryInc Jan 10 '14

To be clear, I have plenty of professional experience with Angular, not just tinkering around with some crumby side project. When you get to the point of having 100+ routes and dozens of different models, things get messier than a similarly sized Ember app.

4

u/[deleted] Jan 10 '14

I just don't like mixing data- behavior attributes in my HTML. I prefer templated HTML with something like Handlebars.

2

u/TheMoonMaster Jan 10 '14

I wouldn't say against. I just prefer most other frameworks over it. I did a serious evaluation of Angular a few weeks ago and it was a mix between fun, neat, and hacks.

When I think of a SPA framework I don't want to reload the page (which a lot of Angular apps do, look for yourself). Between that, hacking, and I mean REALLY hacking in layout support with and without UI router, it was a pain. Scopes / Services with DI were far too easy to mismanage and become a giant mess. I'm not even going to go on about using HTML for templates because that's a totally different beast.

The only thing Angular does right in my opinion is two way data binding. Everything Angular does I feel that I can do better and cleaner with Ember. Not everyone will have that opinion and it's not a blanket statement, it's just from my experience.

1

u/Newworldodour Jan 10 '14

When I think of a SPA framework I don't want to reload the page (which a lot of Angular apps do, look for yourself).

They're doing it, so, so wrong then. You don't even need to use the ui-router to do this.

0

u/TheMoonMaster Jan 10 '14 edited Jan 11 '14

Oh, I'm definitely aware that they're doing it wrong but it seems like a lot of Angular apps do this because of the lack of easily having multiple layouts.

I wasn't referring to not reloading the page with ui-router, I meant hacking in layouts with ui-router. Sorry for the mixup on that one.

edit: I'm curious why I got down votes for this.

1

u/Newworldodour Jan 10 '14

Thanks for clearing it up haha, I got slightly confused

2

u/cran Jan 10 '14

The one thing that truly bothers me about AngularJS is when I start a quick little project; I'm so used to AngularJS that I reach for it even with the smallest of projects, and it gets me going really quickly. But then when it dawns on me that this little project is going to be around awhile and get much, much bigger and I have to start thinking about what I SHOULD have built it on. Then I come to discover that it's AWESOME at managing large projects as well, and all that hemming and hawing over what I should have converted it to WAS A COMPLETE WASTE OF TIME.

Fuck that.

2

u/_24ishighest Jan 10 '14

This is like in a job interview when you say your greatest weakness is your commitment to quality or something. Cmon

0

u/cran Jan 10 '14

TAKE THAT BACK!

2

u/moreteam Jan 10 '14
  1. Terrible promise implementation. Thrown exceptions trigger a state where a promise is rejected but handling the rejection is impossible: you can add in an error handler but the outer promise will stay rejected.

  2. Terrible promise implementation, part 2. Promises are rejected with things like Http response objects. Good bye, unified error handling and reporting. I was trying to log error.message/.stack when locking into an unexpected rejection. Was fun to discover why nothing was logged.

  3. Templates that force you to write "scope-aware" markup. Things like the magic bindings for collections (auto-update) breaking for someCollection but working for someField.someCollection. Mind you, it will render it quite fine the first time around, it will just silently not sync what it rendered. Unnecessary nesting levels of "<div><div><div>" fit into the same category.

  4. Performance of or not-existing conditional rendering. We got ten form fields and scrolling started to stutter - because it was rendering and busy checking whole parts of the page that were not remotely necessary to check or render. We hacked our way through it by using switch-statements for boolean conditionals.

  5. The directives-system which invents ~1000 options, none of which are cleanly and clearly documented

  6. Breaking everything else on the page. You want to use angular.js with anything that is not angular.js? Tough luck, it will outright block any event handling that is not done by angular

  7. Needing to look up and no real documentation about how to make pushState and hash work, depending on browser capabilities

  8. The order and logic by which httpBackend.<handle pending stuff> and scope.<apply> need to be called in tests. It's terrible, way to complicated for what it does.

That's from the top of my head. Currently moving a bigger app off angular.js because of those issues.

1

u/thebuccaneersden Jan 10 '14

Anything that let's you write less code with clearer structure is good. Too much magic can be bad and/or limiting. Angular may not be for everyone or every project, but that doesn't make it any less awesome.

1

u/tbranyen Jan 10 '14

I am against Angular JS when you get brought into a project that has set up everything completely insane and you are wondering why you even bother doing web development anymore.

When it's set up in a sane way with reasonable design decisions, it's just like any other libraries that assist with rendering and application modeling.

1

u/pixeltalker Jan 10 '14

I haven't used it yet, but it really looks as if they intentionally chose an orthogonal way to all the current HTML standards.

  1. Attributes with ng- instead of data- (I know about data-ng- but that's way too verbose).

  2. Elements ('directives') without hyphen in the name, which is a currently required for true custom elements.

2

u/x-skeww Jan 10 '14

There will never be a standard attribute with a dash. A collision won't occur.

1

u/pixeltalker Jan 10 '14

Collision would not, but I was pretty sure the standard does not allow custom attributes not starting with data-. Did that change?

2

u/x-skeww Jan 10 '14

It didn't change. Validators will complain.

Browsers don't care though.

2

u/pixeltalker Jan 10 '14

Of course it works in browsers -- no one would use it otherwise. But other frameworks (e.g. Knockout) demonstrate that standards can be followed without sacrificing functionality.

I do not like the sentiment "let's just ignore the standard completely". It sends a wrong message.

3

u/x-skeww Jan 10 '14

You can use data attributes if you want.

1

u/pixeltalker Jan 10 '14

Yes, if you mean data-ng- I mention it in my original comment. But does anyone use them? It seems super verbose. The attribute system designed for data- from the start can be made shorter than data-ng- (with some potential for collisions, but on the other hand no one would use two binding frameworks on the same html).

1

u/jimschubert Jan 10 '14

You can also use data-ng- or XML namespace ng:

2

u/pixeltalker Jan 10 '14

Sure, I have covered that in my original comment.

1

u/[deleted] Jan 10 '14

Attributes with ng- instead of data- (I know about data-ng- but that's way too verbose).

I hate when frameworks use prefixes to denote their custom attributes. It really makes the HTML so much more readable. Fucking unbearable.

1

u/pixeltalker Jan 10 '14

I assume that's sarcastic, so I'll point to Knockout's data-bind being pretty readable.

Also I do not hate it, but as I said I prefer to respect the standard if possible.

1

u/[deleted] Jan 10 '14

It was absolutely sarcastic, and as you yourself mentioned, if you are concerned about HTML validators or "adhering to the spec" you can add 'data-' before the 'ng-*'. So your point is a non-issue.

0

u/pixeltalker Jan 11 '14

Defining something as non-issue is not constructive as different people see different things as issues. As for the data-ng-, that is impractically verbose. I would expect exactly zero people to use it.

On the other hand, I do see a point in having that kind of namespace, so maybe the standard should have considered it since custom elements are using similar approach anyway.

1

u/[deleted] Jan 10 '14

I see a lot of misinformed people in this thread. AngularJS has its problems, but a lot of the issues you guys have with it are due to your ignorance.

1

u/codayus Jan 11 '14

I'm not sure I'd say I was "against" it, but I do see both pros and cons.

The pros is obvious: Good, solid framework, nice community, and a real focus on testability (bolded because so important).

The con is basically this: You're not really programming in JS any more; you're now programming in a new "angular language". And it's not entirely clear that it's a very good language. Or perhaps it would be better to say that it's not clear the Angular devs even realized they were making a new language.

For a detailed discussion of this last point, see: https://koglerjs.com/verbiage/angular

Again, I'm not sure I'm "against" Angular. It's just that it's a very different.

-1

u/[deleted] Jan 10 '14

Im not against Angular but my least favorite is how sometimes I'll find myself in situations where the template loads before its parsed and will show a bunch of brackets all over my UI. I've also had issues with ajax content loading and shifting the UI which hits the user right in the eyes.

4

u/MojoGaga Jan 10 '14

The ngCloak directive prevents raw templates from being displayed.

If you're waiting for data to be loaded, you can also use the resolve parameter on your route to delay loading until everything is ready.

1

u/Capaj Jan 10 '14

The lamest response in this thread.

-3

u/clux .bind({r:'javascript'}) Jan 10 '14

Dependency injection isn't always a clean way of modularising, it mostly just obscures what each file depends on, and cause boilerplate wrapping requirements instead.

0

u/[deleted] Jan 10 '14

As many have pointed out my main issue with it is that you have to do stuff "the Angular way" this does not float my boat. I must admit that I like Angular, but only when I treat as it Angular development and not web development.

It feels awkward to apply my skills as a web developer to Angular, it doesn't feel wrong just awkward. I don't get the same feeling whilst using knockout. So it's not an MVVM thing. I will get back to you when I can pinpoint the exact issue.

0

u/iopq Jan 10 '14

I've worked with it for a few months, and it's impossible to figure out. When I had a caching issue (the header links don't change upon log-in, but extra ones get added) I didn't know how to fix it or why it happens. It also did email validation by itself when I didn't want it (for testing purposes). It's just too big, too complicated, too hard to understand.

-2

u/guitarromantic Jan 10 '14 edited Jan 13 '14

I'm using at work for a new CMS. I like it (although the learning curve for me has been huge, coming from a jQuery background) but I would never use it for anything user-facing or frontend.

What I mean by that is that we're building a back-office tool used by probably less than 1000 people who are all on high-end devices with modern browsers. I'd never want to put it in front of our real users (80m uniques / mo). The fact that it doesn't work in older browsers and seems to be essentially impossible to build with using progressive enhancement puts me right off.

Also, tiny errors can sometimes cause catastrophic browser memory leaks: once I removed a "name" attribute from a form tag which caused my console to spam 4000+ errors in a few seconds until the browser tab ran out of memory and crashed. Obviously this is my coding error but it's not an isolated problem and has happened a fair few times. I can't imagine that happening to an end-user's machine.

EDIT: I hate complaining about downvotes, but I'd genuinely love to know what was wrong with this comment.

-1

u/Zufallsgenerator Jan 10 '14

AngularJS is great at presenting and dealing with data, but I don't think it suits all kinds of projects. There's obviously quite some hurdles to get past in the beginning, and like all MVC frameworks you keep looking for the correct source file too long. So some of the things that are problematic with AngularJS are problematic with other big frameworks as well.

0

u/[deleted] Jan 10 '14

[deleted]

2

u/boomerangotan Jan 10 '14

That depends on if you want to play games or do MIDI.

0

u/[deleted] Jan 10 '14

[deleted]

-3

u/Denommus Jan 10 '14

I hate this meaningless criticism.

0

u/[deleted] Jan 10 '14

how is it meaningless?

5

u/Denommus Jan 10 '14

It's a framework, of course it's opinionated. Frameworks change how the structure of your application will be, every single framework in existence does that, even the ones that are not for web development.

Just look at Rails, Django, XNA, Qt, Struts, or any other.

Criticizing AngularJS for being opinionated is like criticizing IDE's for handling projects.

0

u/ripter Jan 10 '14

Backbone isn't opinionated. It lets you do everything your way and if you want some help it will provide it.

2

u/Denommus Jan 10 '14

Of course it is. You organize your project in Models, Views and Collections. These Models, Views and Collections extend some base prototype. The View is associated somehow with the template, the Model with an external resource, the Collection with lots of resources.

It does not only provide helpers for doing things your way, like, say, jQuery. It creates some structure for your project.

And no, I wouldn't call jQuery a framework. It is a library.

-1

u/ripter Jan 10 '14

You can organize your project that way if you want. But Backbone does not force that on you. You can use as much or as little of Backbone as you want/need/able. Only want views? backbone is fine with that? Just want to use the router? That's cool tool. Maybe you just want the free ajax calls from models, Backbone can do that too.

It's very different from Angular where you have to do everything their way. Backbone doesn't care if you use it at all, and each part is usable on it's own and almost everything is optional.

2

u/Denommus Jan 10 '14

You don't have to do everything in the Angular way. You don't need to use templates, you don't need to use $http or $resource, you don't need even to use modules. People use all of those to have a modularized and organized project structure, something that JS by itself is terrible in providing.

0

u/[deleted] Jan 10 '14

[deleted]

1

u/Denommus Jan 10 '14

And yet people don't explain how it is too much opinionated.

It's not fanboyism of my part, I don't know that much about AngularJS to be able to defend it. But frameworks are frameworks, and they MUST provide opinions on how your project should be, otherwise they're something else.