TypeScript @angular-core-src-linker-component_resolver.ComponentResolver类(方法)实例源码

下面列出了TypeScript @angular-core-src-linker-component_resolver.ComponentResolver 类(方法)源码代码实例,从而了解它的用法。

作者:AudreyCha    项目:angula   
describe('Compiler', () => {
    var someCompFactory: any /** TODO #9100 */;
    var compiler: ComponentResolver;

    beforeEach(() => {
      someCompFactory = new ComponentFactory(null, null, null);
      reflector.registerType(SomeComponent, new ReflectionInfo([someCompFactory]));
      compiler = new ReflectorComponentResolver(new DummyConsole());
    });

    it('should read the template from an annotation',
       inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
         compiler.resolveComponent(SomeComponent).then((compFactory: ComponentFactory<any>) => {
           expect(compFactory).toBe(someCompFactory);
           async.done();
           return null;
         });
       }));

    it('should throw when given a string',
       inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
         compiler.resolveComponent('someString').catch((e) => {
           expect(e.message).toContain('Cannot resolve component using \'someString\'.')
               async.done();
         });
       }));
  });

作者:0xJoK    项目:angula   
inject([AsyncTestCompleter, ComponentResolver], (async, compiler: ComponentResolver) => {
   compiler.resolveComponent("someString")
       .catch((e) => {
         expect(e.message).toContain("Cannot resolve component using 'someString'.")
         async.done();
       });
 }));

作者:AudreyCha    项目:angula   
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
   compiler.resolveComponent(SomeComponent).then((compFactory: ComponentFactory<any>) => {
     expect(compFactory).toBe(someCompFactory);
     async.done();
     return null;
   });
 }));


问题


面经


文章

微信
公众号

扫码关注公众号