zoukankan      html  css  js  c++  java
  • 开发angular时一些坑人的配置

    angular入门成本很高,原因是坑人的配置太多,而且官网也没有说的很明白,导致一些问题要花很多时间来解决。

    1.查看angular版本,在package.json中查看:下面这个是4.3的版本

      "@angular/animations": "^4.3.0",
      "@angular/common": "^4.3.0",
      "@angular/compiler": "^4.3.0",
      "@angular/core": "^4.3.0",
      "@angular/forms": "^4.3.0",
      "@angular/http": "^4.3.0",
      "@angular/platform-browser": "^4.3.0",
      "@angular/platform-browser-dynamic": "^4.3.0",
      "@angular/router": "^4.3.0",

    2.system.config.js文件,这个文件加载了一些新手看不懂的东西,但是这个文件不注意,你很可能花上几天解决出的问题,文件中都是导入包时一些依赖项。【如果你导入一些东西一直报错,当然这个错在写代码时是看不出来的,都在浏览器里报错,很可能是你原始的system.config.js根本就没加这个东西,比如:'@angular/common/http': 'npm:@angular/common/bundles/common-http.umd.js'这个包,是angular 4.3新特性】。

          '@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js',
          '@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
          '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
          '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
          '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
          '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
          '@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
          '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
          '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
          '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
          '@angular/router/upgrade': 'npm:@angular/router/bundles/router-upgrade.umd.js',
          '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
          '@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',
          '@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js',

    3.子module,如果你分离了app.module.ts 文件,请注意,一些需要import的模块,一定一定要在子module里在注册一次,要不永远找不到。。。

    like this:

    我会不断总结开发中遇到的坑。

  • 相关阅读:
    Python中CreateCompatibleDC和CreateBitmap造成的内存泄漏
    POJ 2420 模拟退火
    LR(1)分析表-语法树-四元式
    C语言文法
    计蒜客 18018 热爱工作的蒜蒜 最短路+dp
    HDU 5988 最小费用流
    POJ 1808 平方剩余
    POJ 2115 单变元模线性方程
    计蒜客 17414 Exponial 指数降幂公式
    计蒜客 17412 Card Hand Sorting 最长公共子序列
  • 原文地址:https://www.cnblogs.com/cxd1008/p/7703884.html
Copyright © 2011-2022 走看看