ng generate directive highlight
CLI 会创建 src/app/highlight.directive.ts 及相应的测试文件(.../spec.ts),并且在根模块 AppModule 中声明这个指令类
ElementRef获取页面元素
也可以直接获取元素class
ng generate directive highlight
CLI 会创建 src/app/highlight.directive.ts 及相应的测试文件(.../spec.ts),并且在根模块 AppModule 中声明这个指令类