• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript lang.stringify函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: BaseException

 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;
 });
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:7,代码来源:template_resolver_mock.ts


示例2: function

 setterFn = function(element, value) {
   if (_isValidAttributeValue(dashCasedAttributeName, value)) {
     DOM.setAttribute(element, dashCasedAttributeName, stringify(value));
   } else {
     if (isPresent(value)) {
       throw new BaseException("Invalid " + dashCasedAttributeName +
       " attribute, only string values are allowed, got '" + stringify(value) + "'");
     }
     DOM.removeAttribute(element, dashCasedAttributeName);
   }
 };
开发者ID:tavwizard,项目名称:angular,代码行数:11,代码来源:property_setter_factory.ts


示例3: _genMessage

 private static _genMessage(typeOrFunc, params: any[][]) {
   var signature = [];
   for (var i = 0, ii = params.length; i < ii; i++) {
     var parameter = params[i];
     if (isBlank(parameter) || parameter.length == 0) {
       signature.push('?');
     } else {
       signature.push(parameter.map(stringify).join(' '));
     }
   }
   return "Cannot resolve all parameters for '" + stringify(typeOrFunc) + "'(" +
          signature.join(', ') + "). " +
          "Make sure that all the parameters are decorated with Inject or have valid type annotations and that '" +
          stringify(typeOrFunc) + "' is decorated with Injectable.";
 }
开发者ID:844496869,项目名称:angular,代码行数:15,代码来源:reflective_exceptions.ts


示例4: it

 it('should create a ChangeDetectorDefinition for the root render proto view', () => {
   var renderPv = createRenderProtoView();
   var defs =
       getChangeDetectorDefinitions(bindDirective(MainComponent).metadata, renderPv, []);
   expect(defs.length).toBe(1);
   expect(defs[0].id).toEqual(`${stringify(MainComponent)}_comp_0`);
 });
开发者ID:lavinjj,项目名称:angular,代码行数:7,代码来源:proto_view_factory_spec.ts


示例5: factory

  factory(t: Type): Function {
    switch (t.length) {
      case 0:
        return function() { return new t(); };
      case 1:
        return function(a1) { return new t(a1); };
      case 2:
        return function(a1, a2) { return new t(a1, a2); };
      case 3:
        return function(a1, a2, a3) { return new t(a1, a2, a3); };
      case 4:
        return function(a1, a2, a3, a4) { return new t(a1, a2, a3, a4); };
      case 5:
        return function(a1, a2, a3, a4, a5) { return new t(a1, a2, a3, a4, a5); };
      case 6:
        return function(a1, a2, a3, a4, a5, a6) { return new t(a1, a2, a3, a4, a5, a6); };
      case 7:
        return function(a1, a2, a3, a4, a5, a6, a7) { return new t(a1, a2, a3, a4, a5, a6, a7); };
      case 8:
        return function(a1, a2, a3, a4, a5, a6, a7, a8) {
          return new t(a1, a2, a3, a4, a5, a6, a7, a8);
        };
      case 9:
        return function(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
          return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9);
        };
      case 10:
        return function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {
          return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
        };
    };

    throw new Error(
        `Cannot create a factory for '${stringify(t)}' because its constructor has more than 10 arguments`);
  }
开发者ID:Bogatinov,项目名称:angular,代码行数:35,代码来源:reflection_capabilities.ts


示例6: _buildRenderDirective

 _buildRenderDirective(directiveBinding) {
   var ann = directiveBinding.annotation;
   var renderType;
   var compileChildren = true;
   if ((ann instanceof Component) || (ann instanceof DynamicComponent)) {
     renderType = renderApi.DirectiveMetadata.COMPONENT_TYPE;
   } else if (ann instanceof Viewport) {
     renderType = renderApi.DirectiveMetadata.VIEWPORT_TYPE;
   } else if (ann instanceof Decorator) {
     renderType = renderApi.DirectiveMetadata.DECORATOR_TYPE;
     compileChildren = ann.compileChildren;
   }
   var setters = [];
   var readAttributes = [];
   ListWrapper.forEach(directiveBinding.dependencies, (dep) => {
     if (isPresent(dep.propSetterName)) {
       ListWrapper.push(setters, dep.propSetterName);
     }
     if (isPresent(dep.attributeName)) {
       ListWrapper.push(readAttributes, dep.attributeName);
     }
   });
   return new renderApi.DirectiveMetadata({
     id: stringify(directiveBinding.key.token),
     type: renderType,
     selector: ann.selector,
     compileChildren: compileChildren,
     events: isPresent(ann.events) ? MapWrapper.createFromStringMap(ann.events) : null,
     bind: isPresent(ann.bind) ? MapWrapper.createFromStringMap(ann.bind) : null,
     setters: setters,
     readAttributes: readAttributes
   });
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:33,代码来源:compiler.ts


示例7: _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 = MapWrapper.get(this._templateCache, component);

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


示例8: _readMetadata

function _readMetadata(componentType: Type) {
  let metadata = reflector.annotations(componentType).filter(f => f instanceof RoutesMetadata);
  if (metadata.length === 0) {
    throw new BaseException(
        `Component '${stringify(componentType)}' does not have route configuration`);
  }
  return metadata[0];
}
开发者ID:AwelEshetu,项目名称:angular,代码行数:8,代码来源:recognize.ts


示例9: it

 it('should not allow overriding a view after it has been resolved', () => {
   viewResolver.resolve(SomeComponent);
   expect(() => {
     viewResolver.setView(SomeComponent, new View({template: 'overridden template'}));
   })
       .toThrowError(
           `The component ${stringify(SomeComponent)} has already been compiled, its configuration can not be changed`);
 });
开发者ID:lavinjj,项目名称:angular,代码行数:8,代码来源:view_resolver_mock_spec.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript lang.DateWrapper类代码示例发布时间:2022-05-25
下一篇:
TypeScript lang.serializeEnum函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap