< BACK

The thing no one mentions when you're learning AngujarJS

So I decided to learn AngularJS, and it was HARD, I mean, frustrating. I couldn’t make my router to work. I downloaded a free book, searched tutorials, watched videos, tried everything, until I found a deep and obscure post on SO that brought light.

There were two reasons why my app was failing:

Do not use the min.js version of angular

The reason for this was simple, you will get better error messages. At first, I said, Angular sucks, I don’t understand the weird messages, it gives me way too much information about the error but I can’t read it. And then I found out that the reason was simple, I was using the min.js file. So don’t.

You will need more than one file

This was the other big reason, I assumed (I know, I’m banging my head against the wall while I write this) that angularjs included everything necesary to run Angular.js, you know, like the router library/component/module, but I found out that it does not, in fact, the angular.js file is probably useless on it’s own, you’ll need a file for the router, another file to handle HTTP requests using the resource module and so on.

The problem was not that I wasn’t including the files, there was no files when downloading angular.js, so you have to go some obscure place where you download everything. As an example, this is what I’m using now:

</code>

As you can see, I’m loading 4 different angular files, all needed, but only the main one is provided when you download the package. So there you go, I hope it saves you hours of frustration.

If you’re curious about the application, you can download the code at Github. Turns out that after the 4 hours of frustration, I’m actually enjoying learning Angular.js.


Share this: