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


TypeScript ListWrapper.removeAt方法代码示例

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


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

示例1: it

      it('should handle incremental swapping element', () => {
        let l = ['a', 'b', 'c'];
        differ.check(l);

        ListWrapper.removeAt(l, 1);
        ListWrapper.insert(l, 0, 'b');
        differ.check(l);
        expect(differ.toString())
            .toEqual(iterableChangesAsString({
              collection: ['b[1->0]', 'a[0->1]', 'c'],
              previous: ['a[0->1]', 'b[1->0]', 'c'],
              moves: ['b[1->0]', 'a[0->1]']
            }));

        ListWrapper.removeAt(l, 1);
        l.push('a');
        differ.check(l);
        expect(differ.toString())
            .toEqual(iterableChangesAsString({
              collection: ['b', 'c[2->1]', 'a[1->2]'],
              previous: ['b', 'a[1->2]', 'c[2->1]'],
              moves: ['c[2->1]', 'a[1->2]']
            }));
      });
开发者ID:844496869,项目名称:angular,代码行数:24,代码来源:default_iterable_differ_spec.ts

示例2: _bindDirectiveProperty

 _bindDirectiveProperty(dirProperty, bindConfig, compileElement, directiveBinder) {
   var pipes = this._splitBindConfig(bindConfig);
   var elProp = ListWrapper.removeAt(pipes, 0);
   var bindingAst = MapWrapper.get(compileElement.bindElement().propertyBindings, dashCaseToCamelCase(elProp));
   if (isBlank(bindingAst)) {
     var attributeValue = MapWrapper.get(compileElement.attrs(), camelCaseToDashCase(elProp));
     if (isPresent(attributeValue)) {
       bindingAst = this._parser.wrapLiteralPrimitive(attributeValue, compileElement.elementDescription);
     }
   }
   if (isPresent(bindingAst)) {
     var fullExpAstWithBindPipes = this._parser.addPipes(bindingAst, pipes);
     directiveBinder.bindProperty(dirProperty, fullExpAstWithBindPipes);
   }
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:15,代码来源:directive_parser.ts

示例3: it

      it('should detect changes in list', () => {
        let l = [];
        differ.check(l);

        l.push('a');
        differ.check(l);
        expect(differ.toString()).toEqual(iterableChangesAsString({
          collection: ['a[null->0]'],
          additions: ['a[null->0]']
        }));

        l.push('b');
        differ.check(l);
        expect(differ.toString())
            .toEqual(iterableChangesAsString(
                {collection: ['a', 'b[null->1]'], previous: ['a'], additions: ['b[null->1]']}));

        l.push('c');
        l.push('d');
        differ.check(l);
        expect(differ.toString()).toEqual(iterableChangesAsString({
          collection: ['a', 'b', 'c[null->2]', 'd[null->3]'],
          previous: ['a', 'b'],
          additions: ['c[null->2]', 'd[null->3]']
        }));

        ListWrapper.removeAt(l, 2);
        differ.check(l);
        expect(differ.toString()).toEqual(iterableChangesAsString({
          collection: ['a', 'b', 'd[3->2]'],
          previous: ['a', 'b', 'c[2->null]', 'd[3->2]'],
          moves: ['d[3->2]'],
          removals: ['c[2->null]']
        }));

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

示例4: detach

 detach(atIndex = -1) {
   if (atIndex == -1)
     atIndex = this._views.length - 1;
   var detachedView = this.get(atIndex);
   ListWrapper.removeAt(this._views, atIndex);
   if (isBlank(this._lightDom)) {
     ViewContainer.removeViewNodes(detachedView);
   } else {
     this._lightDom.redistribute();
   }
   if (isPresent(this.hostLightDom)) {
     this.hostLightDom.redistribute();
   }
   detachedView.changeDetector.remove();
   this._unlinkElementInjectors(detachedView);
   return detachedView;
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:17,代码来源:view_container.ts

示例5: mergeChildComponentProtoViews

 mergeChildComponentProtoViews(protoViews, target) {
   var nestedProtoView;
   if (isPresent(this.componentId)) {
     nestedProtoView = ListWrapper.removeAt(protoViews, 0);
   } else if (isPresent(this.nestedProtoView)) {
     nestedProtoView = this.nestedProtoView.mergeChildComponentProtoViews(protoViews, target);
   }
   return new ElementBinder({
     parentIndex: this.parentIndex,
     textNodeIndices: this.textNodeIndices,
     contentTagSelector: this.contentTagSelector,
     nestedProtoView: nestedProtoView,
     componentId: this.componentId,
     eventLocals: this.eventLocals,
     eventNames: this.eventNames,
     distanceToParent: this.distanceToParent,
     propertySetters: this.propertySetters
   });
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:19,代码来源:element_binder.ts

示例6: it

 it('should remove and add same item', () => {
   l = ['a', 'b', 'c'];
   changes.check(l);
   ListWrapper.removeAt(l, 1);
   changes.check(l);
   expect(changes.toString()).toEqual(iterableChangesAsString({
     collection: ['a', 'c[2->1]'],
     previous: ['a', 'b[1->null]', 'c[2->1]'],
     moves: ['c[2->1]'],
     removals: ['b[1->null]']
   }));
   ListWrapper.insert(l, 1, 'b');
   changes.check(l);
   expect(changes.toString()).toEqual(iterableChangesAsString({
     collection: ['a', 'b[null->1]', 'c[1->2]'],
     previous: ['a', 'c[1->2]'],
     additions: ['b[null->1]'],
     moves: ['c[1->2]']
   }));
 });
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:20,代码来源:iterable_changes_spec.ts

示例7: _bindDirectiveProperty

  _bindDirectiveProperty(bindConfig: string, compileElement: CompileElement,
                         directiveBinderBuilder: DirectiveBuilder) {
    // Name of the property on the directive
    let dirProperty: string;
    // Name of the property on the element
    let elProp: string;
    let pipes: List<string>;
    let assignIndex: number = bindConfig.indexOf(':');

    if (assignIndex > -1) {
      // canonical syntax: `dirProp: elProp | pipe0 | ... | pipeN`
      dirProperty = StringWrapper.substring(bindConfig, 0, assignIndex).trim();
      pipes = this._splitBindConfig(StringWrapper.substring(bindConfig, assignIndex + 1));
      elProp = ListWrapper.removeAt(pipes, 0);
    } else {
      // shorthand syntax when the name of the property on the directive and on the element is the
      // same, ie `property`
      dirProperty = bindConfig;
      elProp = bindConfig;
      pipes = [];
    }

    var bindingAst =
        MapWrapper.get(compileElement.bindElement().propertyBindings, dashCaseToCamelCase(elProp));

    if (isBlank(bindingAst)) {
      var attributeValue = MapWrapper.get(compileElement.attrs(), camelCaseToDashCase(elProp));
      if (isPresent(attributeValue)) {
        bindingAst =
            this._parser.wrapLiteralPrimitive(attributeValue, compileElement.elementDescription);
      }
    }

    // Bindings are optional, so this binding only needs to be set up if an expression is given.
    if (isPresent(bindingAst)) {
      var fullExpAstWithBindPipes = this._parser.addPipes(bindingAst, pipes);
      directiveBinderBuilder.bindProperty(dirProperty, fullExpAstWithBindPipes);
    }
  }
开发者ID:B-Thapa,项目名称:angular,代码行数:39,代码来源:directive_parser.ts

示例8: _bindDirectiveProperty

  _bindDirectiveProperty(dirProperty: string, bindConfig: string, compileElement: CompileElement,
                         directiveBinderBuilder: DirectiveBuilder) {
    var pipes = this._splitBindConfig(bindConfig);
    var elProp = ListWrapper.removeAt(pipes, 0);

    var bindingAst =
        MapWrapper.get(compileElement.bindElement().propertyBindings, dashCaseToCamelCase(elProp));

    if (isBlank(bindingAst)) {
      var attributeValue = MapWrapper.get(compileElement.attrs(), camelCaseToDashCase(elProp));
      if (isPresent(attributeValue)) {
        bindingAst =
            this._parser.wrapLiteralPrimitive(attributeValue, compileElement.elementDescription);
      }
    }

    // Bindings are optional, so this binding only needs to be set up if an expression is given.
    if (isPresent(bindingAst)) {
      var fullExpAstWithBindPipes = this._parser.addPipes(bindingAst, pipes);
      directiveBinderBuilder.bindProperty(dirProperty, fullExpAstWithBindPipes);
    }
  }
开发者ID:188799958,项目名称:angular,代码行数:22,代码来源:directive_parser.ts

示例9: _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:KenWilliamson,项目名称:Angular2HostedMobileApp,代码行数:44,代码来源:url_resolver.ts

示例10: createProtoView

 createProtoView(componentAnnotation, renderProtoView, directives) {
   ListWrapper.push(this.requests, [componentAnnotation, renderProtoView, directives]);
   return ListWrapper.removeAt(this._results, 0);
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:4,代码来源:compiler_spec.ts


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