Angular Tips

Join us in our way to learning Angular.js

Tip: Accessing Filtered Array Outside Ng-repeat

| Comments

There is a common question I get time to time, so I decided to write about it here.

Let’s say I have an array of people and I filter them on a ng-repeat, then I want to access that filtered result to do something. I can imagine a few different use cases:

  • See how many items matched your search to recalculate your pagination.
  • Change the template based on the number of results you have.
  • Display a message if you got no results.
  • Show the quantity of items returned from your search.
  • Etc.

One Year of Angular-tips!

| Comments

On August 2013 I created this blog, and here we are one year later.

For this year, I expect to bring you more articles so we can learn a lot of new stuff. Also, we will probably see some Angular 2.0 stuff for this year, which is awesome.

In this year, we got 235.388 visits which is quite awesome, thank you all for that.

Back to the present, I have something to show here, but for that, you will have to wait :D. Also I have some good ideas for new articles (I am always open to new ideas too).

So, I want to thank you all for your endless support and feedback.

Introduction to Unit Test: Conclusions

| Comments

So we finished this unit test series. How do you feel? Are you going to try unit testing yourself?

I understand that testing can be daunting at first, but give it a try! You can always ask if you get stuck (on the IRC or SO).

There are much more stuff about testing but now that we done this series, I want to write separate articles on smaller subjects until I cover all I know about unit testing.

Cheers and try yourself!

Introduction to Unit Test: Directives

| Comments

Time for the last piece of unit testing, directives.

Directives sounds like a hard piece to test but actually is not bad at all. Of course a big and complex directive is more harder to test but if we stick to TDD, we won’t have any problem.

Introduction to Unit Test: Services

| Comments

Testing a service is not much more difficult than testing a filter, in fact, the same rules applies. The difficulty comes on what you do with your service. It is not the same thing testing a service that holds data (a wizard for example) than a service that does RESTful stuff + cache. I plan to write more testing examples on the future but for this article we are going to set the basics :)

Json Web Tokens: Examples

| Comments

So you liked my article about JWT and you want to see some examples right?

I have you covered with two basic but functional implementations of it both in Sails and Rails which you can adapt to you own framework of choice without hassle.

Json Web Tokens: Introduction

| Comments

Even when is not directly related to Angular, we need to fight with authentication from time to time. So let me explain what’s is this JWT (pronounced jot) which everybody is talking about.

I spent the last few weeks researching about auth methods so bear with me if I make a mistake and send a PR to amend it :P

Introduction to Unit Test: Filters

| Comments

Filters are the easiest components to test in Angular. That is why I decided to explain them first. Our first job is to decide what we want to achieve and in this case I decided to write a custom uppercase filter with options.

What should our filter do? Our filter will uppercase the entire input or just part of it based on an input. Let’s describe how we would like to use it here: