Resolving popular mistakes in Angular JS unit testing (part 1 of many)

Resolving popular mistakes in Angular JS unit testing (part 1 of many)

In this series of posts I will be sharing some common mistakes I’ve made and seen while unit testing Angular JS code. I mostly use Karma with Jasmine, and haven’t tried any of this with other testing frameworks.

Error #1: Unit testing a component controller with $componentController

Since Angular JS 1.5, we can use components instead of directives, and then we can test the component’s controller using $componentController instead of the $controller we used with directives.

Seems pretty much straight forward, however, some things may fail. Let’s see an example.

tl/dr: Please see Conclusion at the end.

(more…)

By | 2017-08-09T10:22:07+00:00 August 9th, 2017|angular, how-to, javascript, unit test|0 Comments

Who’s listening?

There’s a common saying among security specialists and privacy advocates stating that anything that is on the internet cannot be considered to be private. Private means that only the owner of the data has access to it. As an example, many of us use Google Drive to store backups of our data on the cloud. Because we use an account protected by a password (and usually by a 2-factor authentication mechanism), we may think it is private. However, it is not. Anybody working at Google who has access to the server could potentially gain access to our data.

The same happens with our online profiles (not only our social networks profiles). Those pictures that we only share with a selected group of close friends in Facebook or WhatsApp are stored somewhere in the cloud. Our pictures are stored in a remote server in some part of the world, and we don’t even know who has access to them.

(more…)

By | 2017-07-23T01:30:34+00:00 July 23rd, 2017|general, security|0 Comments

Guide to create and publish a Yeoman generator


Guide to create and publish a Yeoman generator


Follow this step-by-step guide to easily create and publish a simple Yeoman generator for Angular JS components in 6 steps.

Yeoman is a web’s scaffolding tool for web apps. It helps us to stay productive by simplifying some of the repetitive tasks we do as developers.

Requirements

We need to install NodeJS with npm, and Yeoman. To download and install NodeJS/npm, please visit https://nodejs.org/ and follow the instructions.

 
(more…)

By | 2017-07-23T01:41:29+00:00 June 30th, 2017|angular, guides, how-to, javascript, yeoman|0 Comments

Why develop Web apps with C# ?

I was recently asked why would someone choose a language like C# for web development over other languages such as PHP or JavaScript. I think it’s important to understand a few things about C# that can be confusing for new developers.

 

Introduction

If we run a quick search, we can find that JavaScript is almost always #1 in the rankings while C# is a few positions below.

(more…)

By | 2017-05-31T02:33:12+00:00 May 31st, 2017|general|0 Comments

Unbinding Angular JS $watch listeners

Removing Angular JS listeners

Unbinding Angular JS $watch listeners

One of the most common practices in Angular JS is to set up a listener that watches over an event or variable change.

This is a good way of detecting a change in a variable in order to trigger some action, for example, let’s say that you want to validate the value of an input in a form.

Let’s see an example. Consider a simple form where you ask for a password and you want to enable the submit button only when the password is at least 5 chars long.

(more…)

By | 2017-07-23T01:43:01+00:00 February 14th, 2016|angular, javascript|0 Comments

Quickly debug and test out PHP code in Symfony 2

Have you ever needed to quickly test out some code on Symfony? Have you ever wanted to test see the output of some code right there in the terminal?

If you answered Yes to that questions or if you just are curious or want to know how to do this, here’s a quick trick that most people don’t know.

(more…)

By | 2017-01-02T18:03:13+00:00 August 12th, 2015|guides, how-to, php, symfony|0 Comments

JSConf Uruguay 2015 recap and thoughts

Last 24th and 25th April I had the chance to attend a new edition of the JSConf Uruguay (https://jsconf.uy), an anual JavaScript Conference held in Montevideo, Uruguay.

This time there were more than 30 speakers from Facebook, Opera, Paypal, MongoDB, Intel, Microsoft, Netflix and other companies from Europe, Latin and North America that provided 26 talks and 6 workshops, covering a lot of different topics related not only to web frontend development but also backend, mobile, pattern designs, architecture, automation, animation & 3D, performance, scaling and other stuff not even related to the web (for example: robots, drones and other funny stuff).

(more…)

By | 2015-08-07T22:05:47+00:00 April 30th, 2015|general, javascript|0 Comments

Quick introduction to Markdown language

The Markdown language was created in 2004 with the goal of enabling people “to write using an easy-to-read, easy-to-write plain text format, and optionally convert it to structurally valid HTML or XHTML.

Today, we can find Markdown language almost everywhere, and this is particularly true for developers. For example, if you use Github, you have probably seen Makdown language in action (look for any  README.md file in any repository).

So this is a quick introduction to the most common hash tags.

(more…)

By | 2017-07-23T01:44:31+00:00 March 20th, 2015|guides, how-to, reference|3 Comments

Easy fix to a common AngularJS Module Error

I have recently started to work on an Angular project and at some point I got:

<

pre class=”lang:js decode:true “>Uncaught Error:

[$injector:nomod] Module ‘app.wizard’ is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.3.12/$injector/nomod?p0=app.wizard

It turned out that it was really easy fix, but it took me a while to figure this out.

(more…)

By | 2017-07-23T01:34:12+00:00 February 6th, 2015|angular, guides, how-to, javascript|4 Comments