code: function insertView(container, viewNode, index) {
      var state = container.data;
      var views = state[VIEWS];
      var lView = viewNode.data;
      if (index > 0) {
          // This is a new view, we need to add it to the children.
          views[index - 1].data[NEXT] = lView;
      }
      if (index < views.length) {
          lView[NEXT] = views[index].data;
          views.splice(index, 0, viewNode);
      }
      else {
          views.push(viewNode);
          lView[NEXT] = null;
      }
      // Dynamically inserted views need a reference to their parent container'S host so it's
      // possible to jump from a view to its container's next when walking the node tree.
      if (viewNode.tNode.index === -1) {
          lView[CONTAINER_INDEX] = container.tNode.parent.index;
          viewNode.view = container.view;
      }
      // Notify query that a new view has been added
      if (lView[QUERIES]) {
          lView[QUERIES].insertView(index);
      }
      // Sets the attached flag
      lView[FLAGS] |= 8 /* Attached */;
      return viewNode;
  }
docs: Inserts a view into a container.
  
  This adds the view to the container's array of active views in the correct
  position. It also adds the view's elements to the DOM if the container isn't a
  root node of another view (in that case, the view's elements will be added when
  the container's parent view is added later).
  
  @param container The container into which the view should be inserted
  @param viewNode The view to insert
  @param index The index at which to insert the view
  @returns The inserted view