angular - Util 模块中 util.isNullOrUndefined(object) 的替代方法是什么? Angular 7

标签 angular module

util.isNullOrUndefined(object) 已折旧,我找不到任何替代方案。有人可以指出一个可行的替代方案吗?

if (isNullOrUndefined(this.activeAppKey) || this.activeAppKey.trim().length === 0) {
  this.activeAppKey = sessionStorage.getItem(AppConstants.APP_KEY);
}

最佳答案

尝试使用 !运算符(operator)。

if (!this.activeAppKey) {
  this.activeAppKey = sessionStorage.getItem(AppConstants.APP_KEY);
}

关于angular - Util 模块中 util.isNullOrUndefined(object) 的替代方法是什么? Angular 7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54627255/

相关文章:

Angular 过滤器在多个数组中查找字符串

html - 无法使用表中的列数组迭代 *ngFor 循环

angular - 覆盖 Angular 中的浏览器 `back` 按钮功能?

linux - 如何在 Ubuntu 启动时加载自定义模块?

c# - 在 Main() 中保持模块化?

ruby - 所有 ruby​​ 文件都应该有一个与文件夹结构相匹配的模块结构吗?

Angular 2 : How to write a for loop, 不是 foreach 循环

javascript - Ionic 3 Keyboard covers(overlays) 聚焦 ionic 输入元件

module - 使用标准库中的模块可以在我的 crate root 中使用,但不能在模块中使用

es6 导入和导出中的模块说明符