8 comments

[ 3.3 ms ] story [ 28.0 ms ] thread
3/5 of the main points listed in the conclusion of the study centered around directives, summed up in one of the points: "although the creation of custom directives is one of the most appreciated characteristics of ANGULARJS, the API that supports this feature is perceived as complex to use and understand by developers"

I just started using AngularJS 1.5 at my new job, coming from react, I actually started a list of problems I encountered. Basically everything stemmed from how complicated it get's working with directives and properly scoping/binding where you want.

I don't know if Angular 2 will face these same issues, they still have directives, but I don't know if they're exactly the same. I "heard" that Angular 2 was supposed to jump on the unidirection binding bandwagon. This stackoverflow Q&A seem to indicate it's still two way binding. http://stackoverflow.com/questions/35469024/how-does-angular...

Anybody know if it's any better?

Been an angular dev for a few years and recently did a 1-2 transition. The API got a lot cleaner and the docs are pretty good. There is still a learning curve and (IMO) a lack of learning resources for anything beyond a simple demo application. Questions like "how do I get the name of the name of the currently activated route?" was one I recently was unable to answer and had to implement a different solution for then in 1.x.

I think angular will suffer from a trickle effect as developers migrate slowly over the course of years from 1.x to 2.x. There is no impetus currently to create advanced learning resources as everybody seems to pretty much be learning at their own rate.

That said I will be implementing future SPA applications using Angular 2 because it offers a very clear value proposition to me and has more great features coming within the next ~6 months, such as server-side rendering iirc.

Edit: To clarify my troubles with finding the activated route name stemmed from a rapidly changing Router API in angular 2. Apparently it's going to be easy in the final version (3.0) but there is no current solution for it apparently. Other then that I really like the new router.

Funny you mentioned routing, that was something I started off with trying to implement first. The existing application didn't have it. So trying to leverage Angular in an appropriate way I wanted to turn on routing for some of the links and slowly fix up the old pages.

I eventually figured that there is no backward compatibility, it's all or nothing. So what I had to do was come up with a little hack to check the URL myself and if it was a configured route enable it. :/

Do you know if the new routing module in 2 will support old links like in my case? I took a quick skim, no mention.

Well Angular 1.x had the ui-router library which basically overhauled the default 1.x routing and added all sorts of nice features through a relatively clean API. Angular 2.x has tried to fix this divergence by incorporating much of that API, but they didn't get it quite right the first time so they're still working on it (IMO).

I don't know exactly what you mean by "routing module that supports old links". Are you referring to the "LocationStrategy" which differentiates between routes such as /#/some-state vs. /some-state (with <base href="/">)?. Or are you moving a non-SPA application to a SPA application w/angular routing?

I think it will be clearer with an example. So we have an application with a left menu and several links in it, here's an example list: /Dashboard/WorkLoad /Accounts/AllPeople /Automotive/CarGallery

I want to add a few new pages, "/Dashboard/Monitoring", "/Dashboard/Logs". I want this to utilize angular with html5mode enabled. This way they can still bookmark the links and come back, or at least the url won't look weird.

I don't want the old links to be broken, as I add pages with routing enabled it should work. It ends up breaking though because if those other three links don't match my two configured links (Monitoring, Logs), it uses "otherwise" to fallback to the home directory "/". There's no way arround this other than detecting and turning on/off the routing.

You can embrace unidirectional flow in Angular 1.X as well even if it's not enforced by the framework. I'd actually recommend it as it makes things so much easier to reason about, but I'll admit that it can be quite verbose, especially without the syntactic sugar that Angular2 provides.
Well angular 2 is mostly written the same way every time you want to build something and is connected through a custom html tag. This allows you to not deal with js that is built 100 different ways for a 100 different reasons. Not just that but file structure is exactly the same always. Basically angular1 was just a step up from JavaScript which seemed nice but really with not much reusability. Plus since you can build components inside components, you don't have to worry about implementation into a project. With RC5s new modules, you don't have to worry about importing into those components. So basically you can easily implement the app into any project with the same components and the same way always. Basically once you make one, you don't have to rewrite it. They even have their own CSS files, and use life cycle hooks so you can have different components fire off at different render times or events. It is basically the jquery of data. Also with easy observables, server side rendering, and simple data binding, you really can do anything. Angular 2 and 1 are night and day.