This is something I wasted half a day finding out what’s wrong with my code.

When watching a property in Angular, by default, when the object has changes Angular will check the object for equality by reference. That means that if you modified a property within your object, or added an item to a watched array, it will not trigger.

The solution is to define the watch’s equality for value instead of reference, this is simply done by adding a boolean property to your watch call.

Read More

I came across a rather unusual feature that had to be implemented; I needed to inject a custom CSS file dynamically based on a certain set of rules to each page (using Chrome Extension’s content-script).

The rules I was asked to consider could not be implemented using match patterns (read more about content-scripts and match patterns in Google’s documentation), so I had to inject a Javascript page that will perform the relevant tests.

Read More

In a previous post I described the benefits of MVP architecture (you can see this post). Now I will try to explain how to implement that design pattern, inspired from Google’s GWT, with JavaScript.

I would assume, for this demo, that you are familiar with the basics of jQuery.

What is MVP?

Model-View-Presenter is a design pattern which separates the code for a specific widget/functionality to three sections:

Model

In which the data model for the widget is defined.

View

In which the logic behind the UI is handled, with UI events, data visualization and other UI centric logic.

Presenter

Where the logic behind the functionality of the widgets rests, such as data manipulation, data storing and loading, application events, etc…

Read More

Nearing the end of 2009 I switched jobs to a new location, where I was tasked with building a new web application. The weapons of choice was Google’s, very new to the time, GWT 2.0.

This was my first exposure to Google’s Java-Compiled-JavaScript, and I was hesitant.

Google Web Toolkit (GWT/ˈɡwɪt/) is an open source set of tools that allows web developers to create and maintain complex JavaScript front-end applications in Java.

GWT emphasizes reusable, efficient solutions to recurring Ajax challenges, namely asynchronous remote procedure calls, history management, bookmarkinginternationalization and cross-browser portability.

Wikipedia – GWT

Read More