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


TypeScript Map.get方法代码示例

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


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

示例1: resolve

  /**
   * Returns the {@link View} for a component:
   * - Set the {@link View} to the overridden view when it exists or fallback to the default
   * `TemplateResolver`,
   *   see `setView`.
   * - Override the directives, see `overrideViewDirective`.
   * - Override the @View definition, see `setInlineTemplate`.
   *
   * @param component
   * @returns {ViewDefinition}
   */
  resolve(component: Type): View {
    var view = this._viewCache.get(component);
    if (isPresent(view)) return view;

    view = this._views.get(component);
    if (isBlank(view)) {
      view = super.resolve(component);
    }

    var directives = view.directives;
    var overrides = this._directiveOverrides.get(component);

    if (isPresent(overrides) && isPresent(directives)) {
      directives = ListWrapper.clone(view.directives);
      MapWrapper.forEach(overrides, (to, from) => {
        var srcIndex = directives.indexOf(from);
        if (srcIndex == -1) {
          throw new BaseException(
              `Overriden directive ${stringify(from)} not found in the template of ${stringify(component)}`);
        }
        directives[srcIndex] = to;
      });
      view = new View(
          {template: view.template, templateUrl: view.templateUrl, directives: directives});
    }

    var inlineTemplate = this._inlineTemplates.get(component);
    if (isPresent(inlineTemplate)) {
      view = new View({template: inlineTemplate, templateUrl: null, directives: view.directives});
    }

    this._viewCache.set(component, view);
    return view;
  }
开发者ID:Salim-K,项目名称:angular,代码行数:45,代码来源:template_resolver_mock.ts

示例2: setter

 setter(name: string): SetterFn {
   if (this._setters.has(name)) {
     return this._setters.get(name);
   } else {
     return this.reflectionCapabilities.setter(name);
   }
 }
开发者ID:Salim-K,项目名称:angular,代码行数:7,代码来源:reflector.ts

示例3: method

 method(name: string): MethodFn {
   if (this._methods.has(name)) {
     return this._methods.get(name);
   } else {
     return this.reflectionCapabilities.method(name);
   }
 }
开发者ID:Salim-K,项目名称:angular,代码行数:7,代码来源:reflector.ts

示例4: 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

示例5: _checkOverrideable

  /**
   * Once a component has been compiled, the AppProtoView is stored in the compiler cache.
   *
   * Then it should not be possible to override the component configuration after the component
   * has been compiled.
   *
   * @param {Type} component
   */
  _checkOverrideable(component: Type): void {
    var cached = this._viewCache.get(component);

    if (isPresent(cached)) {
      throw new BaseException(
          `The component ${stringify(component)} has already been compiled, its configuration can not be changed`);
    }
  }
开发者ID:Salim-K,项目名称:angular,代码行数:16,代码来源:template_resolver_mock.ts

示例6: get

 get(param: string): string {
   var storedParam = this.paramsMap.get(param);
   if (isListLikeIterable(storedParam)) {
     return ListWrapper.first(storedParam);
   } else {
     return null;
   }
 }
开发者ID:cedriclam,项目名称:angular,代码行数:8,代码来源:url_search_params.ts

示例7: interfaces

 interfaces(type: Type): List<any> {
   if (this._injectableInfo.has(type)) {
     var res = this._injectableInfo.get(type)._interfaces;
     return isPresent(res) ? res : [];
   } else {
     return this.reflectionCapabilities.interfaces(type);
   }
 }
开发者ID:goderbauer,项目名称:angular,代码行数:8,代码来源:reflector.ts

示例8: getComponentId

export function getComponentId(componentStringId: string) {
  var id = _componentUIDs.get(componentStringId);
  if (isBlank(id)) {
    id = _nextComponentUID++;
    _componentUIDs.set(componentStringId, id);
  }
  return id;
}
开发者ID:Salim-K,项目名称:angular,代码行数:8,代码来源:util.ts

示例9: factory

 factory(type: Type): Function {
   if (this._containsReflectionInfo(type)) {
     var res = this._injectableInfo.get(type)._factory;
     return isPresent(res) ? res : null;
   } else {
     return this.reflectionCapabilities.factory(type);
   }
 }
开发者ID:goderbauer,项目名称:angular,代码行数:8,代码来源:reflector.ts

示例10: get

  get(url: string): Promise<string> {
    var response = this._responses.get(url);
    if (isBlank(response)) {
      return PromiseWrapper.reject('xhr error', null);
    }

    return PromiseWrapper.resolve(response);
  }
开发者ID:Salim-K,项目名称:angular,代码行数:8,代码来源:style_inliner_spec.ts


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