function nextUid() {
  var index = uid.length;
  var digit;

  while(index) {
    index--;
    digit = uid[index].charCodeAt(0);
    if (digit == 57 /*'9'*/) {
      uid[index] = 'A';
      return uid.join('');
    }
    if (digit == 90  /*'Z'*/) {
      uid[index] = '0';
    } else {
      uid[index] = String.fromCharCode(digit + 1);
      return uid.join('');
    }
  }
  uid.unshift('0');
  return uid.join('');
}
A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric
characters such as '012ABC'. The reason why we are not using simply a number counter is that
the number string gets longer over time, and it can also overflow, where as the nextId
will grow much slower, it is a string, and it will never overflow.

@returns {string} an unique alpha-numeric string