Angular 7升级后样式问题

时间:2019-04-04 14:01:36

标签: css angular twitter-bootstrap npm

我们已经将应用程序从 Angular 5.2升级到7.2 ,样式变得混乱。某些元素(例如,图标和文本)之间的间距已更改,消失或减小。

你们中的任何人在升级Angular应用程序或以下软件包后是否遇到过类似的问题?

我已经将所有可能的软件包都还原到其暂存版本,但是并不能解决问题。

我不知道从哪里开始故障排除以查找问题的根源。 样式和HTML尚未更改。

我们更新了:

  • 引导程序:从4.1.0到4.3.1
  • @ ng-bootstrap / ng-bootstrap:从1.1.2到4.0.0
  • ngx-bootstrap:从2.0.5到4.0.0

样式是 angular.json 中的全局样式: enter image description here

我们在其中导入使用的Bootstrap组件的位置: enter image description here

package.json 看起来像这样:

{
  "private": true,
  "dependencies": {
    "@angular/animations": "7.2.11",
    "@angular/common": "7.2.11",
    "@angular/compiler": "7.2.11",
    "@angular/core": "7.2.11",
    "@angular/forms": "7.2.11",
    "@angular/http": "7.2.11",
    "@angular/platform-browser": "7.2.11",
    "@angular/platform-browser-dynamic": "7.2.11",
    "@angular/platform-server": "7.2.11",
    "@angular/router": "7.2.11",
    "@fortawesome/angular-fontawesome": "0.3.0",
    "@fortawesome/fontawesome-svg-core": "1.2.12",
    "@fortawesome/free-solid-svg-icons": "5.6.3",
    "@ng-bootstrap/ng-bootstrap": "4.0.0",
    "@nguniversal/express-engine": "7.1.1",
    "@ngx-translate/core": "11.0.1",
    "@ngx-translate/http-loader": "4.0.0",
    "acorn": "6.1.1",
    "angular2-image-zoom": "1.2.1",
    "bootstrap": "4.3.1",
    "braintree-web-drop-in": "1.16.0",
    "core-js": "2.6.5",
    "file-saver": "2.0.1",
    "font-awesome": "4.7.0",
    "htmllint": "0.7.3",
    "intl": "1.2.5",
    "jquery": "3.3.1",
    "ng-jhipster": "0.9.3",
    "ng-recaptcha": "4.2.1",
    "ng2-order-pipe": "0.1.5",
    "ngx-bootstrap": "4.0.0",
    "ngx-color-picker": "7.4.0",
    "ngx-cookie": "4.1.2",
    "ngx-webstorage": "3.0.2",
    "popper.js": "1.14.7",
    "print-js": "1.0.54",
    "rxjs": "6.4.0",
    "rxjs-compat": "6.4.0",
    "tslib": "1.9.3",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "0.13.7",
    "@angular/cli": "7.3.7",
    "@angular/compiler-cli": "7.2.11",
    "@angular/language-service": "7.2.11",
    "@types/file-saver": "2.0.0",
    "@types/hammerjs": "2.0.36",
    "@types/jasmine": "3.3.12",
    "@types/jasminewd2": "2.0.6",
    "@types/node": "11.12.0",
    "codelyzer": "5.0.0",
    "jasmine-core": "3.3.0",
    "jasmine-spec-reporter": "4.2.1",
    "karma": "4.0.1",
    "karma-chrome-launcher": "2.2.0",
    "karma-cli": "2.0.0",
    "karma-coverage-istanbul-reporter": "2.0.5",
    "karma-jasmine": "2.0.1",
    "karma-jasmine-html-reporter": "1.4.0",
    "node-sass": "4.11.0",
    "protractor": "6.0.0",
    "sort-json": "2.0.0",
    "ts-node": "8.0.3",
    "tslint": "5.14.0",
    "typescript": "3.2.4"
  }
}

1 个答案:

答案 0 :(得分:3)

我相信从Angular 6开始,IF COUNTD([State]) = 1 THEN [State][1] ELSE "United States" END 选项默认为false。要在全局范围内再次打开它,可以在preserveWhitespace中添加一个选项:

tsconfig.app.json

或者您可以在需要保留空白的任何元素上使用指令"angularCompilerOptions": { "preserveWhitespaces": true }

请参见here上的一些(很多隐藏的)文档。