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


TypeScript ListWrapper.forEachWithIndex方法代码示例

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


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

示例1: _genEventBinding

  /** @internal */
  _genEventBinding(eb: EventBinding): string {
    let codes: String[] = [];
    this._endOfBlockIdxs = [];

    ListWrapper.forEachWithIndex(eb.records, (r, i) => {
      let code;

      if (r.isConditionalSkipRecord()) {
        code = this._genConditionalSkip(r, this._names.getEventLocalName(eb, i));
      } else if (r.isUnconditionalSkipRecord()) {
        code = this._genUnconditionalSkip(r);
      } else {
        code = this._genEventBindingEval(eb, r);
      }

      code += this._genEndOfSkipBlock(i);

      codes.push(code);
    });

    return `
    if (eventName === "${eb.eventName}" && elIndex === ${eb.elIndex}) {
      ${codes.join("\n")}
    }`;
  }
开发者ID:Konviser,项目名称:todo-list,代码行数:26,代码来源:change_detection_jit_generator.ts

示例2: resolvePath

 function resolvePath(pathParts: string[]): string {
   let result = [];
   ListWrapper.forEachWithIndex(pathParts, (part, index) => {
     switch (part) {
       case '':
       case '.':
         if (index > 0) return;
         break;
       case '..':
         if (index > 0 && result.length != 0) result.pop();
         return;
     }
     result.push(part);
   });
   return result.join('/');
 }
开发者ID:NeuroJS,项目名称:angular,代码行数:16,代码来源:static_reflector_spec.ts

示例3: expect

 .andCallFake((args: UiArguments, returnType: Type) => {
   expect(args.method).toEqual(methodName);
   if (isPresent(vals)) {
     expect(args.args.length).toEqual(vals.length);
     ListWrapper.forEachWithIndex(vals, (v, i) => {expect(v).toEqual(args.args[i].value)});
   }
   var promise = null;
   if (isPresent(handler)) {
     let givenValues = args.args.map((arg) => {arg.value});
     if (givenValues.length > 0) {
       promise = handler(givenValues);
     } else {
       promise = handler();
     }
   }
   if (promise == null) {
     promise = PromiseWrapper.wrap(() => {});
   }
   return promise;
 });
开发者ID:ProjectFrank,项目名称:angular,代码行数:20,代码来源:web_worker_test_util.ts

示例4: locals

 get locals(): {[key: string]: string} {
   var varValues: {[key: string]: string} = {};
   // TODO(tbosch): right now, the semantics of debugNode.locals are
   // that it contains the variables of all elements, not just
   // the given one. We preserve this for now to not have a breaking
   // change, but should change this later!
   ListWrapper.forEachWithIndex(
       this._view.staticNodeDebugInfos,
       (staticNodeInfo: StaticNodeDebugInfo, nodeIndex: number) => {
         var vars = staticNodeInfo.varTokens;
         StringMapWrapper.forEach(vars, (varToken, varName) => {
           var varValue;
           if (isBlank(varToken)) {
             varValue = isPresent(this._view.allNodes) ? this._view.allNodes[nodeIndex] : null;
           } else {
             varValue = this._view.injectorGet(varToken, nodeIndex, null);
           }
           varValues[varName] = varValue;
         });
       });
   StringMapWrapper.forEach(this._view.locals,
                            (localValue, localName) => { varValues[localName] = localValue; });
   return varValues;
 }
开发者ID:AwelEshetu,项目名称:angular,代码行数:24,代码来源:debug_context.ts

示例5: it

 it('should iterate over an array passing values and indices', () => {
   var record = [];
   ListWrapper.forEachWithIndex(l, (value, index) => record.push([value, index]));
   expect(record).toEqual([['a', 0], ['b', 1]]);
 });
开发者ID:LordBinary,项目名称:angular,代码行数:5,代码来源:collection_spec.ts

示例6: createPropertyRecords

export function createPropertyRecords(definition: ChangeDetectorDefinition): ProtoRecord[] {
  var recordBuilder = new ProtoRecordBuilder();
  ListWrapper.forEachWithIndex(definition.bindingRecords,
                               (b, index) => recordBuilder.add(b, definition.variableNames, index));
  return coalesce(recordBuilder.records);
}
开发者ID:KenWilliamson,项目名称:Angular2HostedMobileApp,代码行数:6,代码来源:proto_change_detector.ts


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