docs: function(index, word) {
                      // Define the ID attribute of the span that will wrap the word, and the associated jQuery selector string
                      var word_id = cloud_namespace + "_word_" + index,
                          word_selector = "#" + word_id,
                          angle = 6.28 * Math.random(),
                          radius = 0.0,
  
                          // Only used if option.shape == 'rectangular'
                          steps_in_direction = 0.0,
                          quarter_turns = 0.0,
  
                          weight = 5,
                          custom_class = "",
                          inner_html = "",
                          word_span;
  
                      // Leave out custom html for now.
  
                      // Check if min(weight) > max(weight) otherwise use default
                      if (word_array[0].weight > word_array[word_array.length - 1].weight) {
                          // Linearly map the original weight to a discrete scale from 1 to 10
                          weight = Math.round((word.weight - word_array[word_array.length - 1].weight) /
                                              (word_array[0].weight - word_array[word_array.length - 1].weight) * (WEIGHTS_LENGTH - 1)) + 1;
                      }
  
                      // Create a new span and insert node.
                      word_span = document.createElement("span");
                      word_span.className = 'w' + weight;
                      var textNode = document.createTextNode(word.text);
  
                      // Append href if there's a link alongwith the tag
                      if (word.link !== undefined && word.link !== "") {
                          // If link is a string, then use it as the link href
                          if (typeof word.link === "string") {
                              var href = word.link;
                          }
  
                          // Extend link html options with defaults
                          if ( options.encodeURI ) {
                              href = encodeURI(href).replace(/'/g, "%27");
                          }
  
                          var word_link = document.createElement("a");
                          word_link.href = href;
                          word_link.appendChild(textNode);
                          word_span.appendChild(word_link);
                      } else {
  
                          // If there's no link attribute
                          word_span.appendChild(textNode);
                      }
  
  
                      // Bind handlers to words (though not really useful in this version!)
                      //                if (!!word.handlers) {
                      //                  for (var prop in word.handlers) {
                      //                    if (word.handlers.hasOwnProperty(prop) && typeof word.handlers[prop] === 'function') {
                      //                        word_span.addEventListener(prop,word.handlers[prop]);
                      //                    }
                      //                  }
                      //                }$scope.cloudClick(word.text)
                      var $ = angular.element;
                      if($scope.cloudClick){
                          $(word_span).click({text:word.text},$scope.cloudClick);
                          $(word_span).addClass('cloud-word');
                      }
                      $this.appendChild(word_span);
  
                      if(options.weights) {
                          word_span.style.fontSize = options.weights[weight -1];
                      }
  
                      var width = word_span.offsetWidth,
                          height = word_span.offsetHeight,
                          left = options.center.x - width / 2.0,
                          top = options.center.y - height / 2.0;
  
                      // Save a reference to the style property, for better performance
                      var word_style = word_span.style;
                      word_style.position = "absolute";
                      word_style.left = left + "px";
                      word_style.top = top + "px";
  
                      while(hitTest(word_span, already_placed_words)) {
                          // option shape is 'rectangular' so move the word in a rectangular spiral
                          if (options.shape === "rectangular") { //not enabled in this version.
                              steps_in_direction++;
                              if (steps_in_direction * step > (1 + Math.floor(quarter_turns / 2.0)) * step * ((quarter_turns % 4 % 2) === 0 ? 1 : aspect_ratio)) {
                                  steps_in_direction = 0.0;
                                  quarter_turns++;
                              }
                              switch(quarter_turns % 4) {
                                  case 1:
                                      left += step * aspect_ratio + Math.random() * 2.0;
                                      break;
                                  case 2:
                                      top -= step + Math.random() * 2.0;
                                      break;
                                  case 3:
                                      left -= step * aspect_ratio + Math.random() * 2.0;
                                      break;
                                  case 0:
                                      top += step + Math.random() * 2.0;
                                      break;
                                                      }
                          } else { // Default settings: elliptic spiral shape
                              radius += step;
                              angle += (index % 2 === 0 ? 1 : -1)*step;
  
                              left = options.center.x - (width / 2.0) + (radius*Math.cos(angle)) * aspect_ratio;
                              top = options.center.y + radius*Math.sin(angle) - (height / 2.0);
                          }
                          word_style.left = left + "px";
                          word_style.top = top + "px";
                      }
  
                      // Don't render word if part of it would be outside the container
                      if (options.removeOverflowing && (left < 0 || top < 0 || (left + width) > options.width || (top + height) > options.height)) {
                          word_span.remove();
                          return;
                      }
  
  
                      already_placed_words.push(word_span);
  
                      // Invoke callback if existing
                      if (typeof(word.afterWordRender) === "function") {
                          word.afterWordRender.call(word_span);
                      }
                  }