一:创建服务
ng g service 服务名 // 将创建到指定目录下面 ng g service 文件名/服务名 // 例如 ng g service myService/storage
二:在 app.module.ts 里面引入创建的服务
三:使用服务(在需要使用服务的地方进行如下配置)