DirectiveResolver
resolve(type: Type) : DirectiveMetadata
Return DirectiveMetadata for a given Type.
resolve(type: Type): DirectiveMetadata { |
debug 跟踪后找到 Class RuntimeMetadataResolver 这次扒皮应该会挖出怎么动态加载组件,指令什么的
getDirectiveMetadata(directiveType: Type): cpl.CompileDirectiveMetadata { |
谁调用了getDirectiveMetadata?
compileHostComponentRuntime(type: Type): Promise<HostViewFactory> { |
谁调用了compileHostComponentRuntime 呢?
@Injectable() |
继续…
就回到DynamicComponentLoader_
loadAsRoot(type: Type, overrideSelector: string, injector: Injector, onDispose?: () => void, |
后面继续跟踪type是怎么来的,这个很重要
其实就是组件名字。。
@Component({ |
回顾一下:
几种metadata:
- compiledTemplate
- hostMeta
- compMeta
- CompileDirectiveMetadata
- DirectiveMetadata
- viewMeta
- templateMeta
- metadata
还有几种Cache:
- hostCacheKey
- compilingComponentCacheKeys
- _directiveCache