Conditional Checking in AngularJs using Restangular

This problem seems specific but its the age old “get details of parent document when you only have the child documents” problem now in the fun world of a client side application.

Problem: A page in an angularJs application contains a list of notes made by an attendee on a number of presentations.

If that presentation has been marked as complete then they you should be able to click on any given note and be taken directly to the slide they made the note on.

If however the presentation has not been made public then it should just be static text, the api call that returns the list of notes does not contain the public/notpublic details, so we have to make another API call to the presentations to find out if their are public.

However we want to keep the number of calls to a minimum and use existing code if suitable.

This project is using Restangular, described as an “AngularJS service to handle Rest API Restful Resources properly and easily”, which as far as I am concerned is both wonderful and bloody woeful. The framework tends to make hard things easy, and easy things hard. In this case I just want the JSON that a GET call returns. To do that, and not get all the extra objects that Restangular adds, you have to alter the root app.js of your app so that you can get an “original” response.

Bung the following code in the function that contains “function (RestangularProvider)” <– I am assuming that you already have Restangular up and working

        // add originalElement to the response so we can
        // have un-restangularized objects as well
        RestangularProvider.setResponseExtractor(function(response) {
          var newResponse = response;
          newResponse.original = angular.copy(response);
          //console.log("response", newResponse.original);
          return newResponse;

Now in the controller of the page you are displaying the notes on you want to add the following to the init ( ensuring that your “.service” contains “ApiRestangular” )

  init: function () {
           function(successResponse) {
             angular.extend($scope, {
              presentationlist: successResponse.original
           function(errorResponse) {           

This makes a Restangular call to the ‘api/events/presentations’ api and when it gets the result, it fetches the original JSON result and stuff its in the “presentationlist” variable in the $scope
You now have an in memory array you can search to get more info straight from the page e.g

 isPresentationPublic: function (note) {
          if (typeof this.$scope.presentationlist === 'undefined') {
            return false;
          } else {
            for (var i = 0; i <= this.$scope.presentationlist.length; i++) { 
              if (note.idOfPresentation == this.$scope.presentationlist[i].id) {
                return this.$scope.presentationlist[i].ispublic

(It should be noted that this is pure user interface stuff, and not meant to be secure).

IBM ConnectED2015 All work and no play

(If this post sounds a bit world weary its not meant to be)

Sooooo, the ‘last lotusphere’ has come and gone, leaving a warm feeling* and more than a few tears, how did IBM handle the passing of one of their longest running conferences.

It was a far smaller conference (or rather intimate as IBM have stated) but it was sized as such so we were not rattling around in the 11,000 space that we have for previous years, there seemed to be just over 2000 of us with a few space issues, it looks like IBM padded the numbers a little bit too much with their own staff (although with IBM staff no one knew or cared about while denying access to the people the comunity really wanted to see)

Looking at the new offerings it feels like a major change coming from IBM, during the good times IBM products did 80% of what the clients wanted with the parters like LDC filling in the remaining 20%, however in the last few years IBM products have only been providing 50%-60% of what clients wants (compared to the competition) meaning people simply did not buy them and thus the partners got to provide 0%, now IBM seem to be fighting back with their design team leading the charge, however to me they seem to aiming to provide about 95% of what clients want…will the remaining 5% be worth waiting round for? (though it has been pointed out to me that 5% of a much bigger pie would still be a good thing)

To me a lot of what is shown was designed for users not partners, I think that the age of partners is nearly over

IBM Verse

  1. On par with GMail (even if there is a lot of mad icon placement)
  2. Some unique features such as the mute thread and the waiting for action (ooooh is that going to be abused by managers), xpages intergeneration side verse and running on bluemix.

Connections Next

  1. Lots of new features a lot of them aimed at the cloud, I need to have a look at them in detail to pass judgement, but such a sudden jerk away from on premises, runs a bad risk of angering existing customers while not gaining any new ones,

LDC were there in force (or rather LDCVia as we are are now named to match our first product) and nicely on brand even if were cant manage the reputable part yet.


Julian and Ben handled the night time work and the socialising, I seemed to end up talking to partners while wearing smart trousers and a shirt (I’m not sure how this happened), but it was good talking about a real product we have built and how we could glue it to other vendors offerings to build something even better.

Matt was hugely missed but as he and his good lady were getting ready for the arrival of their second born I suppose we can let it slide just this once (but don’t let it happen again)

I did not do hardly any drinking or going out this year mainly due to being shattered at the end of each day and also having work to do, but the turtles ( Gab, Tim and Mike) insisted that I go out for a round Epcot pub crawl (a drink at every country) which turned out to be one of the best nights I have ever had at the conference, why Why WHY had we never done this before



Personally this was the most business orientated conference I have ever done, other than the fact I was in jeans less than half the time, this was the first time I have got to go to the leadership Alliance, that and the champion status let me talk to a lot more people about “stuff” than I ever have before. there was also far less “conferencing” for me, I did not attend the closing sessions or any of the IBM parties but still only managed a few hours sleep a night as there was so much going on (I was also looking for work and that takes up time)



The session of the conference goes to Mark Roden’s and Mark Leusinks excellent “The future of web development write once, run everywhere with angular js and domino” which had everything a good session should have

  1. Topical (AngularJS)
  2. Relevant to target audience (Domino)
  3. Interesting and well presented
  4. Something to take home (the app is live)


Happily my own session went over quite well, with a reasonable turn out (my sessions being so fringe are never that well populated) and excellent audience participation. so I’m happy.


Where does this leave next year??, the merging of this conference into the giant IBM one in Vegas makes a lot of sense to a certain marketing point of view, but it would also kill the life and technical content of the conference formally known as lotusphere, leaving only the lugs to go to if you want to learn anything, but as marketing hold the purse strings for this kind of thing I dare say they will have their way (booo)

All in all a great conference and even if it was the last one it was a great send off, roll on [Engage]( in march

*Like pissing your self in a dark suit