问题是,我的表单无法获取输入数据,并且在提交时不会在控制台中显示其值。
我已经将ngModel放在每个输入元素上。我还在app.module.ts中导入了FormsModule。
这是我的控制台的屏幕截图:Console
HTML:
<preference name="AutoHideSplashScreen" value="false" />
<preference name="SplashScreenDelay" value="8000" />
<preference name="FadeSplashScreenDuration" value="1000" />
<preference name="SplashScreen" value="screen" />
<preference name="ShowSplashScreen" value="true" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="FadeSplashScreen" value="true" />
打字稿:
{
"name": "Test",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "^7.2.2",
"@angular/core": "^7.2.2",
"@angular/forms": "^7.2.2",
"@angular/http": "^7.2.6",
"@angular/platform-browser": "^7.2.2",
"@angular/platform-browser-dynamic": "^7.2.2",
"@angular/router": "^7.2.2",
"@ionic-native/core": "^5.0.0",
"@ionic-native/http": "^5.2.0",
"@ionic-native/local-notifications": "^5.2.0",
"@ionic-native/screen-orientation": "^5.2.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/sqlite": "^5.2.0",
"@ionic-native/sqlite-porter": "^5.2.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic-native/toast": "^5.1.0",
"@ionic-native/wheel-selector": "^5.1.0",
"@ionic/angular": "^4.0.0",
"@ionic/storage": "^2.2.0",
"cordova-android": "7.1.4",
"cordova-browser": "5.0.4",
"cordova-ios": "4.5.5",
"cordova-plugin-advanced-http": "2.0.5",
"cordova-plugin-badge": "0.8.8",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-file": "6.0.1",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^3.1.2",
"cordova-plugin-local-notification": "0.9.0-beta.2",
"cordova-plugin-screen-orientation": "3.0.1",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-plugin-x-toast": "2.7.2",
"cordova-sqlite-storage": "3.1.0",
"cordova-wheel-selector-plugin": "1.1.2",
"core-js": "^2.5.4",
"es6-promise-plugin": "4.2.2",
"highcharts": "^6.2.0",
"plotly": "^1.0.6",
"rxjs": "^6.4.0",
"rxjs-compat": "^6.4.0",
"uk.co.workingedge.cordova.plugin.sqliteporter": "1.1.0",
"zone.js": "~0.8.29"
},
"devDependencies": {
"@angular-devkit/architect": "~0.12.3",
"@angular-devkit/build-angular": "~0.12.3",
"@angular-devkit/core": "~7.2.3",
"@angular-devkit/schematics": "~7.2.3",
"@angular/cli": "7.2.4",
"@angular/compiler": "~7.2.2",
"@angular/compiler-cli": "^7.2.6",
"@angular/language-service": "~7.2.2",
"@ionic/angular-toolkit": "~1.4.0",
"@ionic/lab": "1.0.21",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~10.12.0",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^4.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~8.0.0",
"tslint": "~5.12.0",
"typescript": "~3.1.6"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-wheel-selector-plugin": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
},
"cordova-plugin-ionic-keyboard": {},
"cordova-sqlite-storage": {},
"cordova-plugin-x-toast": {},
"uk.co.workingedge.cordova.plugin.sqliteporter": {},
"cordova-plugin-advanced-http": {},
"cordova-plugin-local-notification": {},
"cordova-plugin-screen-orientation": {}
},
"platforms": [
"ios",
"browser",
"android"
]
}
}