本文介绍了Angular 4.3.4 打破了 mdInput 和 md-input-container的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作团队最近从 4.3.0 升级到了 Angular 4.3.3.在这些更改之后, mdInput 和 md-input-container 不再正常运行.在您点击输入字段之前,动画将如 material.angular.io/components/input 所示那样工作.

My team at work recently went to Angular 4.3.3 from 4.3.0. After these changes, mdInput and md-input-container no longer function correctly. Before you could click into the input field and the animation would work as shown on material.angular.io/components/input.

是否有其他人遇到过这个问题?如果有,您采取了哪些措施来解决这些问题?可能需要回到 4.3.0.

Has anyone else run into this issue and if so, what steps did you take to resolve them? May need to go back to 4.3.0.

package.json -

"dependencies": {
    "@angular/animations": "^4.3.3",
    "@angular/cdk": "^2.0.0-beta.8",
    "@angular/common": "^4.3.3",
    "@angular/compiler": "^4.3.3",
    "@angular/core": "^4.3.3",
    "@angular/flex-layout": "^2.0.0-beta.8",
    "@angular/forms": "^4.3.3",
    "@angular/http": "^4.3.3",
    "@angular/material": "^2.0.0-beta.8",
    "@angular/platform-browser": "^4.3.3",
    "@angular/platform-browser-dynamic": "^4.3.3",
    "@angular/router": "^4.3.3",
    "core-js": "^2.4.1",
    "hammerjs": "^2.0.8",
    "ngx-clipboard": "^8.0.4",
    "rxjs": "^5.4.1",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "^1.1.3",
    "@angular/compiler-cli": "^4.3.3",
    "@angular/language-service": "^4.3.3",
    "@types/jasmine": "2.5.45",
    "@types/node": "~6.0.60",
    "codelyzer": "~3.0.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "node-sass": "^4.5.3",
    "protractor": "~5.1.2",
    "ts-node": "~3.0.4",
    "tslint": "~5.3.2",
    "typescript": "~2.3.3"
  }

推荐答案

我相信我找到了问题的答案.在我的 index.html 上,我链接到了这个:

I believe that I found an answer to the question. On my index.html I was linking to this:

  <link href="https://rawgit.com/angular/material2-builds/master/prebuilt-themes/indigo-pink.css" rel="stylesheet">

但是,当我从 index.html 中删除它并将其添加到 style.scss 时:

However, when I removed that from the index.html and added this to styles.scss:

@import '~@angular/material/prebuilt-themes/indigo-pink.css';

它工作得很好,我没有像以前那样出现问题.

it worked just fine and I didn't have the issues like before.

这篇关于Angular 4.3.4 打破了 mdInput 和 md-input-container的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 18:17