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


TypeScript RenderDirectiveMetadata.create方法代码示例

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


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

示例1: expect

 expect(() => {
   createDirectiveVariableBindings(new RenderElementBinder({variableBindings: new Map()}), [
     directiveBinding({metadata: RenderDirectiveMetadata.create({exportAs: 'exportName'})}),
     directiveBinding(
         {metadata: RenderDirectiveMetadata.create({exportAs: 'exportName'})})
   ]);
 }).not.toThrow();
开发者ID:lavinjj,项目名称:angular,代码行数:7,代码来源:proto_view_factory_spec.ts

示例2: it

      it("should calculate directive variable bindings", () => {
        var dvbs = createDirectiveVariableBindings(
            new RenderElementBinder({
              variableBindings:
                  MapWrapper.createFromStringMap<string>({"exportName": "templateName"})
            }),
            [
              directiveBinding(
                  {metadata: RenderDirectiveMetadata.create({exportAs: 'exportName'})}),
              directiveBinding(
                  {metadata: RenderDirectiveMetadata.create({exportAs: 'otherName'})})
            ]);

        expect(dvbs).toEqual(MapWrapper.createFromStringMap<number>({"templateName": 0}));
      });
开发者ID:lavinjj,项目名称:angular,代码行数:15,代码来源:proto_view_factory_spec.ts

示例3: it

      it('should parse host configuration', () => {
        var md = RenderDirectiveMetadata.create({
          host: MapWrapper.createFromPairs([
            ['(event)', 'eventVal'],
            ['[prop]', 'propVal'],
            ['@action', 'actionVal'],
            ['attr', 'attrVal']
          ])
        });

        expect(md.hostListeners).toEqual(MapWrapper.createFromPairs([['event', 'eventVal']]));
        expect(md.hostProperties).toEqual(MapWrapper.createFromPairs([['prop', 'propVal']]));
        expect(md.hostActions).toEqual(MapWrapper.createFromPairs([['action', 'actionVal']]));
        expect(md.hostAttributes).toEqual(MapWrapper.createFromPairs([['attr', 'attrVal']]));
      });
开发者ID:lavinjj,项目名称:angular,代码行数:15,代码来源:api_spec.ts

示例4: process

          process(el('<some-comp></some-comp>'), null, [someComponent, someComponentDup]);
        }).toThrowError(new RegExp('Only one component directive is allowed per element'));
      });

      it('should sort the directives and store the component as the first directive', () => {
        var results = process(el('<some-comp some-decor></some-comp>'));
        expect(annotatedDirectives[results[0].directives[0].directiveIndex].id)
            .toEqual('someComponent');
        expect(annotatedDirectives[results[0].directives[1].directiveIndex].id)
            .toEqual('someDirective');
      });
    });
  });
}

var someComponent = RenderDirectiveMetadata.create(
    {selector: 'some-comp', id: 'someComponent', type: RenderDirectiveMetadata.COMPONENT_TYPE});

var someComponentDup = RenderDirectiveMetadata.create(
    {selector: 'some-comp', id: 'someComponentDup', type: RenderDirectiveMetadata.COMPONENT_TYPE});

var someComponent2 = RenderDirectiveMetadata.create(
    {selector: 'some-comp2', id: 'someComponent2', type: RenderDirectiveMetadata.COMPONENT_TYPE});

var someDirective = RenderDirectiveMetadata.create(
    {selector: '[some-decor]', id: 'someDirective', type: RenderDirectiveMetadata.DIRECTIVE_TYPE});

var someDirectiveIgnoringChildren = RenderDirectiveMetadata.create({
  selector: '[some-decor-ignoring-children]',
  compileChildren: false,
  type: RenderDirectiveMetadata.DIRECTIVE_TYPE
开发者ID:lavinjj,项目名称:angular,代码行数:31,代码来源:directive_parser_spec.ts


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