ng存根 动态为Angular组件和指令创建存根。 安装 npm install --save-dev 用法示例 import { Component , OnInit , EventEmitter , Input , Output } from '@angular/core' ; @ Component ( { selector : 'app-greeter' , template : '<button (click)="onClick()">Say Hi</button>' , styleUrls : [ './greeter.component.css' ] } ) export class GreeterComponent { @ Input ( ) name : string ; @ Output ( ) greet = new EventEmitt