Dell Limerick Hackathon 2016

Hi everybody!

Last January we had an Hackathon here @ Dell Limerick, the main theme was “office productivity”, aka “how would you improve your and your coworker’s productivity”.

I was in a team with other 4 very smart guys, didn’t won but all in all it was a terrific experience…two days straight of brainstorming and coding madness combined with pizza and energy drinks.

The winners came up with an interesting prototype of a chat bot running as Lync addon that can answer every type of question, from “how’s the weather” to “who broke the last build?”, passing from “tell me about story 1234567”. I can’t go too deep in the details (also, lots of natural language analysis is involved) but it was definitely a very, very interesting project and really deserved to win.

My team instead…well we produced a voting platform for ideas. In a nutshell, every user registered to the community can post his ideas (which can be divided into macro-areas) and the others can vote it using points they have received when registering. If an idea is approved, the voters will get back the points and a small bonus. If an idea is cancelled instead, they will get the points back (but no bonus).

It was a cool project to work on, we used a very simple micro-service CQRS architecture running on AngularJS, WebApi and MongoDB. Oh and everything was hosted on Azure.

After the contest, we decided to release all the sources, you can find them on my GitHub repository.


the importance of scope.apply() when testing promises

“remember kids, Jasmine likes to apply”

…sorry, what?

Well, basically, it’s simple: when writing unit tests on promises with Jasmine, remember to call $scope.apply(), it will save you some headaches!

take a look at this AngularJs controller. Look at it.

as you can see, on line 18 there’s a call to and two callbacks are used to handle the success and error cases.

Here instead, there’s an example of how you could test the error case:

in the beforeEach() block a mock service is created with a rejected promise (line 9) and on line 15 the controller is instantiated with the mocked dependencies.

On line 23 there’s the core of the test: a call to $scope.apply().
Without it the promise will not be resolved and any method chain will not be executed.
The reason is simple: the promises implementation is tied to the digest cycle, which is not handled by Jasmine. Calling $scope.apply() will update the internal status and take care of digest for you.


“Mastering AngularJS for .NET Developers” is here!

Finally! I thought the package had gone lost but then…today the postman knocked the office doors aaaaaand here it is!

mastering angularjs - book


It’s an interesting book indeed. Covers most of the functionalities, front to back with an eye to the inner workings and how to integrate with .NET, EntityFramework and WebAPI.

Personally, I’m not a big fan of SPAs . I mean, for example there are cases when you need to hide some parts of the system using some kind of role management. Handling everything server-side “should” grant an higher level of security.

Also, you don’t send to the client unnecessary html blocks, which is always a good thing.

Anyway, here’s my little piece of satisfaction 😀

Data pagination with WebAPI and AngularJS – part 2

Hi all! Looks like the article I wrote some time ago about data pagination with AngularJS is still getting some attention, so I decided to give it a quick update just to spicy things a little bit.

In one of my project I needed a way to run different actions before running the actual pagination, so after some thought I decided to enter the marvelous world of callbacks.

In order to make things more generic, I took advantage of what I wrote in my last post and updated the pager code adding a callback on the page links: this way we can execute a custom function every time the user clicks on one of the links of the pager.

All I had to do was to create the isolated scope and add a pointer to the callback using the ‘&’ attribute. In case you need some refreshing, here’s a nice article about how to pass data to a directive.
Finally, you can check the code here, in the demoPager directive.

Here’s the link to the project on GitHub:


How to pass custom functions to AngularJS directives

In case you need to pass a callback to your AngularJS directives, looks like one way is to create an isolated scope and create a member with the ‘&’ attr. Here’s a quick&dirty example:

In case you have to pass some arguments to the callback, here’s how:

Notice that the argument is transformed in a javascript object and passed to the callback which is actually a wrapped function around the one you passed.

© 2019 Davide Guida

Theme by Anders NorenUp ↑