angularjs - 在角度应用程序中注入字符串有什么好处
问题描述
ng-book 中有一个关于依赖注入的很好的解释,但是关于
import { Inject } from "@angular/core";
export class AnalyticsDemoComponent {
constructor(@Inject("API_URL") apiUrl: string) {
// works! do something w/ apiUrl
}
}
作为 DI 这样做有什么意义,与使用配置变量相比有什么好处吗?
解决方案
推荐阅读
- matlab - MATLAB中系统的零极点图和频率响应
- azure-application-insights - 应用程序洞察无法下载 nuget 包
- jdbc - 使用 tableau 的 JDBC 连接是否需要用户名和密码?
- mysql - 如何在 vb.net 中按数据视图分组
- java - 如何在java中按对象值对JsonNode进行排序
- reactjs - 使用 react-chartjs-2 增加图例和图表之间的填充
- python - Pycharm 在不同的控制台中运行
- python - 如何将熊猫列表行转换为 numpy 数组?
- react-native-flatlist - 将数据添加到响应本机 Web 上的 FlatList,同时保持可见内容
- react-hooks - 验证后 React Hook useCallback()?