pengkobe / reading-notes

:stars: to record daily reading notes. I build an issue blog to record daily FE study notes. suggestion and comments are welcomed.
https://github.com/pengkobe/reading-notes/issues
MIT License
13 stars 1 forks source link

@angular/core #453

Open pengkobe opened 6 years ago

pengkobe commented 6 years ago

angular/core 包括哪些内容呢?看下源码下 core 目录下的文件

看上去内容有点多,我们列下重点内容

注入器 Injector

你可以这么用

const componentInjector = Injector.create([], this.injector);

组件工厂 ComponentFactory

this.componentFactory = this.injector.get(ComponentFactoryResolver)
                                .resolveComponentFactory(this.component);
this.componentRef =
     this.componentFactory.create(componentInjector, null, element);

事件发射器

EventEmitter

ChangeDetectorRef

 this.changeDetectorRef.detectChanges();

反射( reflect ) 与依赖注入( di )

渲染器( render )

解析器( compile )

变化检测( change_detection )

其它