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

TypeScript api.DirectiveMetadata类代码示例

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

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



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

示例1: expect

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


示例2: it

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

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


示例3: it

      it('should parse host configuration', () => {
        var md = DirectiveMetadata.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:AsherBarak,项目名称:angular,代码行数:15,代码来源:api_spec.ts


示例4: it

      it('should run the steps and build the proto view', inject([AsyncTestCompleter], (async) => {
           var compiler = createCompiler((parent, current, control) => {
             current.inheritedProtoView.bindVariable('b', 'a');
           });

           var dirMetadata = DirectiveMetadata.create(
               {id: 'id', selector: 'CUSTOM', type: DirectiveMetadata.COMPONENT_TYPE});
           compiler.compileHost(dirMetadata)
               .then((protoView) => {
                 expect(DOM.tagName(resolveInternalDomProtoView(protoView.render).element))
                     .toEqual('CUSTOM');
                 expect(mockStepFactory.viewDef.directives).toEqual([dirMetadata]);
                 expect(protoView.variableBindings)
                     .toEqual(MapWrapper.createFromStringMap({'a': 'b'}));
                 async.done();
               });
         }));
开发者ID:B-Thapa,项目名称:angular,代码行数:17,代码来源:compiler_common_tests.ts


示例5:

        //
        //    expect(document.activeElement.id).toEqual("focused-input");
        //
        //    // update class of input
        //
        //    expect(document.activeElement.id).toEqual("focused-input");
        //  });
        //});
      });
    });

  });
}


var mainDir = DirectiveMetadata.create(
    {selector: 'main', id: 'main', type: DirectiveMetadata.COMPONENT_TYPE});

var simple = DirectiveMetadata.create(
    {selector: 'simple', id: 'simple', type: DirectiveMetadata.COMPONENT_TYPE});

var empty = DirectiveMetadata.create(
    {selector: 'empty', id: 'empty', type: DirectiveMetadata.COMPONENT_TYPE});

var dynamicComponent = DirectiveMetadata.create(
    {selector: 'dynamic', id: 'dynamic', type: DirectiveMetadata.COMPONENT_TYPE});

var multipleContentTagsComponent = DirectiveMetadata.create({
  selector: 'multiple-content-tags',
  id: 'multiple-content-tags',
  type: DirectiveMetadata.COMPONENT_TYPE
});
开发者ID:Salim-K,项目名称:angular,代码行数:32,代码来源:shadow_dom_emulation_integration_spec.ts


示例6: constructor

  if (isPresent(parent)) {
    current.inheritedProtoView = parent.inheritedProtoView;
  }
};

class FakeTemplateLoader extends TemplateLoader {
  _urlData: Map<string, string>;
  constructor(urlData) {
    super(null, new UrlResolver());
    this._urlData = urlData;
  }

  load(template: ViewDefinition) {
    if (isPresent(template.template)) {
      return PromiseWrapper.resolve(DOM.createTemplate(template.template));
    }

    if (isPresent(template.absUrl)) {
      var content = MapWrapper.get(this._urlData, template.absUrl);
      return isPresent(content) ?
                 PromiseWrapper.resolve(DOM.createTemplate(content)) :
                 PromiseWrapper.reject(`Failed to fetch url "${template.absUrl}"`, null);
    }

    return PromiseWrapper.reject('Load failed', null);
  }
}

var someComponent = DirectiveMetadata.create(
    {selector: 'some-comp', id: 'someComponent', type: DirectiveMetadata.COMPONENT_TYPE});
开发者ID:B-Thapa,项目名称:angular,代码行数:30,代码来源:compiler_common_tests.ts


示例7: expect

        expect(annotatedDirectives[results[0].directives[1].directiveIndex].id)
            .toEqual('someDirective');
      });
    });
  });
}

class MockStep implements CompileStep {
  processClosure: Function;
  constructor(process) { this.processClosure = process; }
  process(parent: CompileElement, current: CompileElement, control: CompileControl) {
    this.processClosure(parent, current, control);
  }
}

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

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

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

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

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript api.RenderDirectiveMetadata类代码示例发布时间:2022-05-25
下一篇:
TypeScript reflection.reflector类代码示例发布时间: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