Skip to main content

My conclusions using Angular 2 for the first time

I’ve been working these days using Angular2 for the first time and this is what I have to say.

It hasn’t been easy to get used to Angular2 and I still don’t really know how some things are working. My rule of thumb: If it works, don’t touch it.Adrián Gómez

Before starting with this text, I have to say this opinion is totally personal and based in my own experience. Talking about my experience: I’ve been working with Angular 1 for more than three years. I started with Angular 1.2.3 and I’m currently using version 1.5.8 with these rules:

  • I use a Component based architecture and Components only deal with “scope”.
  • I only use Factory for services and they usually have all the business logic.
  • Directives just for small DOM things.
  • John Papa styleguide is a good ruleset to follow.

(more…)

To bind nor not to bind

If you have read my previous article about chaining promises, you’ll know I love using small functions in “then” methods, but sometimes chaining is not that simple.

For example, when you have to execute in your “then” method a function receiving two parameters it is not possible… or it is?

In these cases you can use some alternatives as seen below:

  1. Using an anonymous function to chain our second promise
  2. Use “bind”  to pass the second parameter to our second function
  3. Wrap our second function into another function and chain this wrapper instead.

(more…)

Adrián G. is Stephen Fry proof thanks to caching by WP Super Cache