Angular Tips

Join us in our way to learning Angular.js

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:

Transclusion and Scopes

| Comments

The problem

There is a common misconception that I see when I am doing Angular support. My goal here is to address it.

Let’s imagine I have this simple controller and directive:

Introduction to Unit Test: Spies

| Comments

Before we deep more into Angular lands, I want to talk about spies. No, no that kind of spies.

When you are doing unit testing, you don’t want to leave your SUT (subject under test) domain. If you’re testing a controller in Angular and it injects 3 services, you don’t care about those services, you only want to test that controller but also make sure it uses the services as intended.

Introduction to Unit Test: Introduction

| Comments

Let’s talk about unit testing our applications.

What is unit testing and why should I care?

Unit tests are a bunch of Javascript files that we create to make sure that every part of our application works as it is expected to work. That means that we need to write hundred of lines of code to assert that our code does what is supposed to do.

  • Isn’t that a waste of time? The boss is always telling us that we need to be faster and hundred of lines doesn’t sound like fast. Au contraire, that bunch of code will save us HOURS. Don’t believe me? I have proofs.

Tip: Computed Properties With Javascript Properties

| Comments

First, I apologize for not updating the blog as much as expected. I am kinda busy with other stuff and I am writing an Angular book. I want to write more so I am going to find some ideas that won’t be covered in my book. Well, let’s get started.

There is a question I see a lot about Angular: Does it support computed properties? Well, there is no direct support in the framework like with Ember, but you can certainly create computed properties. Let’s see an example, the typical example:

Experiment: Decorating Directives

| Comments

DISCLAIMER: This is an experiment, it is not something officially supported and because of that, this is not meant for beginners. Use it at your own risk and take notice that a bad use of it can break the Internet.

Jokes aside, this could be useful in a bunch of use cases. It is up to you to decide.

Ever had a third party directive where you wished it had any extra behavior you wanted? I did.