angular 9 升级 angular 10

Fork Me On Github

单例服务 Singleton services

ts
       
export class ThemeModule {
  static forRoot(): ModuleWithProviders {
    return {
      ngModule: ThemeModule
    };
  }
}
1234567

修改为

ts
     
static forRoot(): ModuleWithProviders<ThemeModule> {
    return {
        ngModule: ThemeModule
    };
}
12345

CommonJS or AMD dependencies can cause optimization bailouts warning

解决办法:

配置 CommonJS 依赖项

修改 angular.json

projects > 项目名 > architect > build > options

添加 allowedCommonJsDependencies 填入依赖名

json
      
"options": {
    "allowedCommonJsDependencies": [
        "lodash",
        "jsonapi-deserializer"
    ],
}
123456
点击查看全文
标签: angular
0 875 0
在 angular 项目中实现对页面的访问控制
按下回车键,焦点移动到下一个表单或提交表单
使用ng-template 显示tree结构数据
使用 ViewContainerRef.createComponent 替代 ComponentFactoryResolver
angular 12使用 KaTex 显示 AsciiMath 格式的公式