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


TypeScript StringMapWrapper.contains方法代码示例

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


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

示例1: config

  /**
   * Given a component and a configuration object, add the route to this registry
   */
  config(parentComponent, config: StringMap<string, any>): void {
    if (!StringMapWrapper.contains(config, 'path')) {
      throw new BaseException('Route config does not contain "path"');
    }

    if (!StringMapWrapper.contains(config, 'component') &&
        !StringMapWrapper.contains(config, 'components') &&
        !StringMapWrapper.contains(config, 'redirectTo')) {
      throw new BaseException(
          'Route config does not contain "component," "components," or "redirectTo"');
    }

    var recognizer: RouteRecognizer = MapWrapper.get(this._rules, parentComponent);

    if (isBlank(recognizer)) {
      recognizer = new RouteRecognizer();
      MapWrapper.set(this._rules, parentComponent, recognizer);
    }

    config = normalizeConfig(config);

    if (StringMapWrapper.contains(config, 'redirectTo')) {
      recognizer.addRedirect(config['path'], config['redirectTo']);
      return;
    }

    var components = config['components'];
    StringMapWrapper.forEach(components, (component, _) => this.configFromComponent(component));

    recognizer.addConfig(config['path'], config, config['as']);
  }
开发者ID:Mariem-07,项目名称:angular,代码行数:34,代码来源:route_registry.ts

示例2: transform

  transform(value: string, mapping: {[key: string]: string}): string {
    if (!isStringMap(mapping)) {
      throw new InvalidPipeArgumentException(I18nSelectPipe, mapping);
    }

    return StringMapWrapper.contains(mapping, value) ? mapping[value] : mapping['other'];
  }
开发者ID:844496869,项目名称:angular,代码行数:7,代码来源:i18n_select_pipe.ts

示例3: 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:MingXingTeam,项目名称:awesome-front-end,代码行数:7,代码来源:shared.ts

示例4: createProtoChangeDetector

 createProtoChangeDetector(definition: ChangeDetectorDefinition): ProtoChangeDetector {
   var id = definition.id;
   if (StringMapWrapper.contains(this._protoChangeDetectors, id)) {
     return StringMapWrapper.get(this._protoChangeDetectors, id)(this.registry);
   }
   return this._dynamicChangeDetection.createProtoChangeDetector(definition);
 }
开发者ID:baraksu,项目名称:angular,代码行数:7,代码来源:change_detection.ts

示例5: generate

 generate(params: StringMap<string, string>): string {
   if (!StringMapWrapper.contains(params, this.name)) {
     throw new BaseException(
         `Route generator for '${this.name}' was not included in parameters passed.`)
   }
   return normalizeBlank(StringMapWrapper.get(params, this.name));
 }
开发者ID:AsherBarak,项目名称:angular,代码行数:7,代码来源:path_recognizer.ts

示例6:

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

示例7: config

  /**
   * Given a component and a configuration object, add the route to this registry
   */
  config(parentComponent, config: StringMap<string, any>): void {
    assertValidConfig(config);

    var recognizer: RouteRecognizer = this._rules.get(parentComponent);

    if (isBlank(recognizer)) {
      recognizer = new RouteRecognizer();
      this._rules.set(parentComponent, recognizer);
    }

    if (StringMapWrapper.contains(config, 'redirectTo')) {
      recognizer.addRedirect(config['path'], config['redirectTo']);
      return;
    }

    config = StringMapWrapper.merge(
        config, {'component': normalizeComponentDeclaration(config['component'])});

    var component = config['component'];
    var terminal = recognizer.addConfig(config['path'], config, config['as']);

    if (component['type'] == 'constructor') {
      if (terminal) {
        assertTerminalComponent(component['constructor'], config['path']);
      } else {
        this.configFromComponent(component['constructor']);
      }
    }
  }
开发者ID:Salim-K,项目名称:angular,代码行数:32,代码来源:route_registry.ts

示例8: onChange

 onChange(c) {
   if (!this._added) {
     setUpControl(this.control, this);
     this.control.updateValidity();
     this._added = true;
   }
   if (StringMapWrapper.contains(c, "model")) {
     this.control.updateValue(this.model);
   }
 }
开发者ID:codetker,项目名称:angular,代码行数:10,代码来源:form_control_directive.ts

示例9: normalizeConfig

/*
 * Given a config object:
 * { 'component': Foo }
 * Returns a new config object:
 * { components: { default: Foo } }
 *
 * If the config object does not contain a `component` key, the original
 * config object is returned.
 */
function normalizeConfig(config: StringMap<string, any>): StringMap<string, any> {
  if (!StringMapWrapper.contains(config, 'component')) {
    return config;
  }
  var newConfig = {'components': {'default': config['component']}};

  StringMapWrapper.forEach(config, (value, key) => {
    if (key != 'component' && key != 'components') {
      newConfig[key] = value;
    }
  });

  return newConfig;
}
开发者ID:Mariem-07,项目名称:angular,代码行数:23,代码来源:route_registry.ts

示例10: assertValidConfig

function assertValidConfig(config: StringMap<string, any>): void {
  if (!StringMapWrapper.contains(config, 'path')) {
    throw new BaseException(`Route config should contain a "path" property`);
  }
  var targets = 0;
  ListWrapper.forEach(ALLOWED_TARGETS, (target) => {
    if (StringMapWrapper.contains(config, target)) {
      targets += 1;
    }
  });
  if (targets != 1) {
    throw new BaseException(
        `Route config should contain exactly one 'component', or 'redirectTo' property`);
  }
}
开发者ID:AsherBarak,项目名称:angular,代码行数:15,代码来源:route_registry.ts


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