當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript directive_resolver.DirectiveResolver類代碼示例

本文整理匯總了TypeScript中@angular/compiler/src/directive_resolver.DirectiveResolver的典型用法代碼示例。如果您正苦於以下問題:TypeScript DirectiveResolver類的具體用法?TypeScript DirectiveResolver怎麽用?TypeScript DirectiveResolver使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DirectiveResolver類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

    it('should support inheriting the Directive metadata', function() {
      @Directive({selector: 'p'})
      class Parent {
      }

      class ChildNoDecorator extends Parent {}

      @Directive({selector: 'c'})
      class ChildWithDecorator extends Parent {
      }

      expect(resolver.resolve(ChildNoDecorator)).toEqual(core.createDirective({
        selector: 'p',
        inputs: [],
        outputs: [],
        host: {},
        queries: {},
        guards: {},
        exportAs: undefined,
        providers: undefined
      }));

      expect(resolver.resolve(ChildWithDecorator)).toEqual(core.createDirective({
        selector: 'c',
        inputs: [],
        outputs: [],
        host: {},
        queries: {},
        guards: {},
        exportAs: undefined,
        providers: undefined
      }));
    });
開發者ID:Cammisuli,項目名稱:angular,代碼行數:33,代碼來源:directive_resolver_spec.ts

示例2: it

      it('should combine host bindings and listeners during inheritance', () => {
        @Directive({selector: 'p'})
        class Parent {
          @HostListener('p11') @HostListener('p12')
          p1() {}

          @HostBinding('p21') @HostBinding('p22')
          p2: any;
        }

        class Child extends Parent {
          @HostListener('c1')
          p1() {}

          @HostBinding('c2')
          p2: any;
        }

        const directiveMetadata = resolver.resolve(Child);
        expect(directiveMetadata.host).toEqual({
          '(p11)': 'p1()',
          '(p12)': 'p1()',
          '(c1)': 'p1()',
          '[p21]': 'p2',
          '[p22]': 'p2',
          '[c2]': 'p2'
        });
      });
開發者ID:AnthonyPAlicea,項目名稱:angular,代碼行數:28,代碼來源:directive_resolver_spec.ts

示例3: it

    it('should support inheriting the Directive metadata', function() {
      @Directive({selector: 'p'})
      class Parent {
      }

      class ChildNoDecorator extends Parent {}

      @Directive({selector: 'c'})
      class ChildWithDecorator extends Parent {
      }

      expect(resolver.resolve(ChildNoDecorator))
          .toEqual(new Directive({selector: 'p', inputs: [], outputs: [], host: {}, queries: {}}));

      expect(resolver.resolve(ChildWithDecorator))
          .toEqual(new Directive({selector: 'c', inputs: [], outputs: [], host: {}, queries: {}}));
    });
開發者ID:DzmitryShylovich,項目名稱:angular,代碼行數:17,代碼來源:directive_resolver_spec.ts

示例4: it

      it('should support inheriting host listeners', () => {
        @Directive({selector: 'p'})
        class Parent {
          @HostListener('p1')
          p1() {}
          @HostListener('p21')
          p2() {}
        }

        class Child extends Parent {
          @HostListener('p22')
          p2() {}
          @HostListener('p3')
          p3() {}
        }

        const directiveMetadata = resolver.resolve(Child);
        expect(directiveMetadata.host).toEqual({'(p1)': 'p1()', '(p22)': 'p2()', '(p3)': 'p3()'});
      });
開發者ID:molcik,項目名稱:Angular,代碼行數:19,代碼來源:directive_resolver_spec.ts


注:本文中的@angular/compiler/src/directive_resolver.DirectiveResolver類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。