angular定义公共的方法

1、ng g service services/common

2、在app.module.ts引入并配置

 3、在要调用该方法的组件中引入并定义

原文地址:https://www.cnblogs.com/cazj/p/11906733.html