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


TypeScript collection.StringMapWrapper类代码示例

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


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

示例1: parseEventName

  static parseEventName(eventName: string): {[key: string]: string} {
    var parts: string[] = eventName.toLowerCase().split('.');

    var domEventName = parts.shift();
    if ((parts.length === 0) ||
        !(StringWrapper.equals(domEventName, 'keydown') ||
          StringWrapper.equals(domEventName, 'keyup'))) {
      return null;
    }

    var key = KeyEventsPlugin._normalizeKey(parts.pop());

    var fullKey = '';
    modifierKeys.forEach(modifierName => {
      if (ListWrapper.contains(parts, modifierName)) {
        ListWrapper.remove(parts, modifierName);
        fullKey += modifierName + '.';
      }
    });
    fullKey += key;

    if (parts.length != 0 || key.length === 0) {
      // returning null instead of throwing to let another plugin process the event
      return null;
    }
    var result = StringMapWrapper.create();
    StringMapWrapper.set(result, 'domEventName', domEventName);
    StringMapWrapper.set(result, 'fullKey', fullKey);
    return result;
  }
开发者ID:beta3000,项目名称:hola-angular2,代码行数:30,代码来源:key_events.ts

示例2: it

 it('should merge values in provided dictionary', () => {
   var map = StringMapWrapper.create();
   StringMapWrapper.set(map, 'foo', 'bar');
   var headers = new Headers(map);
   expect(headers.get('foo')).toBe('bar');
   expect(headers.getAll('foo')).toEqual(['bar']);
 });
开发者ID:hankduan,项目名称:angular,代码行数:7,代码来源:headers_spec.ts

示例3: group

 static group(group: modelModule.ControlGroup): StringMap<string, boolean> {
   var res = {};
   StringMapWrapper.forEach(group.controls, (control, name) => {
     if (group.contains(name) && isPresent(control.errors)) {
       Validators._mergeErrors(control, res);
     }
   });
   return StringMapWrapper.isEmpty(res) ? null : res;
 }
开发者ID:chiragjraval,项目名称:AdvisroySystemPOC,代码行数:9,代码来源:validators.ts

示例4: group

  group(controlsConfig: {[key: string]: any},
        extra: {[key: string]: any} = null): modelModule.ControlGroup {
    var controls = this._reduceControls(controlsConfig);
    var optionals = isPresent(extra) ? StringMapWrapper.get(extra, "optionals") : null;
    var validator = isPresent(extra) ? StringMapWrapper.get(extra, "validator") : null;

    if (isPresent(validator)) {
      return new modelModule.ControlGroup(controls, optionals, validator);
    } else {
      return new modelModule.ControlGroup(controls, optionals);
    }
  }
开发者ID:hankduan,项目名称:angular,代码行数:12,代码来源:form_builder.ts

示例5: _reduceControls

 /** @internal */
 _reduceControls(controlsConfig: any): {[key: string]: modelModule.AbstractControl} {
   var controls: {[key: string]: modelModule.AbstractControl} = {};
   StringMapWrapper.forEach(controlsConfig, (controlConfig, controlName) => {
     controls[controlName] = this._createControl(controlConfig);
   });
   return controls;
 }
开发者ID:hankduan,项目名称:angular,代码行数:8,代码来源:form_builder.ts

示例6:

 StringMapWrapper.forEach(control.errors, (value, error) => {
   if (!StringMapWrapper.contains(res, error)) {
     res[error] = [];
   }
   var current: any[] = res[error];
   current.push(control);
 });
开发者ID:chiragjraval,项目名称:AdvisroySystemPOC,代码行数:7,代码来源:validators.ts

示例7: function

 return function(control: modelModule.Control) {
   var res = ListWrapper.reduce(validators, (res, validator) => {
     var errors = validator(control);
     return isPresent(errors) ? StringMapWrapper.merge(res, errors) : res;
   }, {});
   return StringMapWrapper.isEmpty(res) ? null : res;
 };
开发者ID:chiragjraval,项目名称:AdvisroySystemPOC,代码行数:7,代码来源:validators.ts

示例8: isPropertyUpdated

export function isPropertyUpdated(changes: {[key: string]: any}, viewModel: any): boolean {
  if (!StringMapWrapper.contains(changes, "model")) return false;
  var change = changes["model"];

  if (change.isFirstChange()) return true;
  return !looseIdentical(viewModel, change.currentValue);
}
开发者ID:jianliao,项目名称:angular-upgrade-demo,代码行数:7,代码来源:shared.ts


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