加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angular2后台管理系统

发布时间:2020-12-17 08:55:45 所属栏目:安全 来源:网络整理
导读:angular2-4对angular1的改变是颠覆性的,增加了npm,typescript,@等目前前端开发流行的元素,但坑多 github上开源项目:https://github.com/mrholek/CoreUI-Free-Bootstrap-Admin-Template/tree/master/Angular2_CLI_Full_Project 这是基于angular2的后台管

angular2-4对angular1的改变是颠覆性的,增加了npm,typescript,@等目前前端开发流行的元素,但坑多

github上开源项目:https://github.com/mrholek/CoreUI-Free-Bootstrap-Admin-Template/tree/master/Angular2_CLI_Full_Project
这是基于angular2的后台管理系统

执行npm start时webpack:compiled successfully,但运行时报错,如下:

EXCEPTION: Uncaught (in promise): Error: Cannot find module './dashboard/dashboard.module'.
Error: Cannot find module './dashboard/dashboard.module'.
    at ZoneAwareError (http://localhost:4200/polyfills.bundle.js:6361:33)
    at webpackAsyncContext (http://localhost:4200/main.bundle.js:35:25)
    at SystemJsNgModuleLoader.webpackJsonp.../../../../_@angular_core@2.4.9@@angular/core/src/linker/system_js_ng_module_factory_loader.js.SystemJsNgModuleLoader.loadAndCompile

显然是路由ts文件中报错,但设置是对的。
将路由文件代码中./改为app/就可以,原因是angular-cli版本过低,解决方法调高angular-cli版本。

改了后,npm start,编译报错,如下:

Searching for devices...
iTunes is not available for this operating system. You will not be able to work with connected iOS devices.
Executing before-prepare hook from /home/dhrn/NativeApp/Supervisor/hooks/before-prepare/nativescript-dev-typescript.js
Found peer TypeScript 2.4.1
node_modules/rxjs/Subject.d.ts(16,22): error TS2415: Class 'Subject<T>' incorrectly extends base class 'Observable<T>'.
  Types of property 'lift' are incompatible.
    Type '<R>(operator: Operator<T,R>) => Observable<T>' is not assignable to type '<R>(operator: Operator<T,R>) => Observable<R>'.
      Type 'Observable<T>' is not assignable to type 'Observable<R>'.
        Type 'T' is not assignable to type 'R'.

原因是package.json中typescript与rxjs版本冲突,可以在tsconfig.json中增加:”noStrictGenericChecks”: true,如下:

{
  "compilerOptions": { "baseUrl": "","declaration": false,"emitDecoratorMetadata": true,"noStrictGenericChecks": true,"experimentalDecorators": true,"lib": [ "es2016","dom" ],"mapRoot": "./","module": "es2016","moduleResolution": "node","outDir": "../dist/out-tsc","sourceMap": true,"target": "es5","typeRoots": [ "../node_modules/@types" ] } }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读