当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ListWrapper.insert方法代码示例

本文整理汇总了TypeScript中angular2/src/core/facade/collection.ListWrapper.insert方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ListWrapper.insert方法的具体用法?TypeScript ListWrapper.insert怎么用?TypeScript ListWrapper.insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在angular2/src/core/facade/collection.ListWrapper的用法示例。


在下文中一共展示了ListWrapper.insert方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

      it('should support insertions/moves', () => {
        let l = ['a', 'a', 'b', 'b'];
        differ.check(l);

        ListWrapper.insert(l, 0, 'b');
        differ.check(l);
        expect(differ.toString())
            .toEqual(iterableChangesAsString({
              collection: ['b[2->0]', 'a[0->1]', 'a[1->2]', 'b', 'b[null->4]'],
              previous: ['a[0->1]', 'a[1->2]', 'b[2->0]', 'b'],
              additions: ['b[null->4]'],
              moves: ['b[2->0]', 'a[0->1]', 'a[1->2]']
            }));
      });
开发者ID:hankduan,项目名称:angular,代码行数:14,代码来源:default_iterable_differ_spec.ts

示例2: attachViewInContainer

  // Misnomer: this method is attaching next to the view container.
  attachViewInContainer(parentView: viewModule.AppView, boundElementIndex: number,
                        contextView: viewModule.AppView, contextBoundElementIndex: number,
                        index: number, view: viewModule.AppView) {
    if (isBlank(contextView)) {
      contextView = parentView;
      contextBoundElementIndex = boundElementIndex;
    }
    parentView.changeDetector.addChild(view.changeDetector);
    var viewContainer = parentView.viewContainers[boundElementIndex];
    if (isBlank(viewContainer)) {
      viewContainer = new viewModule.AppViewContainer();
      parentView.viewContainers[boundElementIndex] = viewContainer;
    }
    ListWrapper.insert(viewContainer.views, index, view);
    var elementInjector = contextView.elementInjectors[contextBoundElementIndex];

    for (var i = view.rootElementInjectors.length - 1; i >= 0; i--) {
      if (isPresent(elementInjector.parent)) {
        view.rootElementInjectors[i].link(elementInjector.parent);
      }
    }
    elementInjector.traverseAndSetQueriesAsDirty();
  }
开发者ID:beta3000,项目名称:hola-angular2,代码行数:24,代码来源:view_manager_utils.ts

示例3: _removeDotSegments

/**
  * Removes dot segments in given path component, as described in
  * RFC 3986, section 5.2.4.
  *
  * @param {string} path A non-empty path component.
  * @return {string} Path component with removed dot segments.
  */
function _removeDotSegments(path: string): string {
  if (path == '/') return '/';

  var leadingSlash = path[0] == '/' ? '/' : '';
  var trailingSlash = path[path.length - 1] === '/' ? '/' : '';
  var segments = path.split('/');

  var out = [];
  var up = 0;
  for (var pos = 0; pos < segments.length; pos++) {
    var segment = segments[pos];
    switch (segment) {
      case '':
      case '.':
        break;
      case '..':
        if (out.length > 0) {
          ListWrapper.removeAt(out, out.length - 1);
        } else {
          up++;
        }
        break;
      default:
        out.push(segment);
    }
  }

  if (leadingSlash == '') {
    while (up-- > 0) {
      ListWrapper.insert(out, 0, '..');
    }

    if (out.length === 0) out.push('.');
  }

  return leadingSlash + out.join('/') + trailingSlash;
}
开发者ID:chiragjraval,项目名称:AdvisroySystemPOC,代码行数:44,代码来源:url_resolver.ts


注:本文中的angular2/src/core/facade/collection.ListWrapper.insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。