Ich versuche, ein einfaches Formular mit AngularJS 2 zu erstellen, indem Sie dem Beispiel in der Kurzanleitung (https://angular.io/docs/ts/latest/guide/forms.html) folgen.
Wenn ich altes Formularmodul deaktiviere und neues Formularmodul wie in der bootstrap() - Funktion vorgeschlagen, bekomme ich einen Kompilierungsfehler.Angular2 Formulare Kompilierfehler bei Verwendung von [disableDeprecatedForms(), provideForms()] in bootstrap()
Ich bin sehr neu in AngularJs. Jede Hilfe wird geschätzt. Details sind unten angegeben:
Nach dem Hinzufügen von "[disableDeprecatedForms(), defaultForms()]" auf die Bootstrap-Funktion, wirft es einen Kompilierungsfehler.
Unten ist der Code, den ich in main.ts Datei habe.
import { bootstrap } from '@angular/platform-browser-dynamic';
import { disableDeprecatedForms, provideForms } from '@angular/forms';
import { AppComponent } from './app.component';
bootstrap(AppComponent,[ appRouterProviders ], [
disableDeprecatedForms(),
\t \t \t \t provideForms()
\t \t \t \t ]);
/*
bootstrap(AppComponent,[ appRouterProviders ]);
*/
Ich erhalte die unten Kompilierungsfehler, wenn "npm start" wird transpiling, wenn ich den obigen Code in main.ts. haben
Wenn ich die Bootstrap() aufrufen, innerhalb von Kommentaren gezeigt verwenden, kompiliert es ohne Fehler, aber wirft eine Warnung „* Es sieht aus wie Sie die alten Formen Modul verwenden ....“
[0] app/main.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target.
[0] 9:24:40 PM - Compilation complete. Watching for file changes.
Wenn ich "npm start" mit diesem Code in main.ts starte, weigert sich npm einfach zu starten und gibt ERR! Unten ist der Auszug aus npm-debug.log:
11 silly lifecycle [email protected]~start: Args: [ '-c', 'tsc && concurrently "npm run tsc:w" "npm run lite" ' ]
12 silly lifecycle [email protected]~start: Returned: code: 2 signal: null
13 info lifecycle [email protected]~start: Failed to exec start script
14 verbose stack Error: [email protected] start: `tsc && concurrently "npm run tsc:w" "npm run lite" `
14 verbose stack Exit status 2
14 verbose stack at EventEmitter.<anonymous> (/home/justin/.nvm/versions/node/v6.3.1/lib/node_modules/npm/lib/utils/lifecycle.js:242:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (/home/justin/.nvm/versions/node/v6.3.1/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:852:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid [email protected]
16 verbose cwd /commonarea/vboxshared/www/backend/yii2/basic/web/kitchen
17 error Linux 3.19.0-15-generic
18 error argv "/home/justin/.nvm/versions/node/v6.3.1/bin/node" "/home/justin/.nvm/versions/node/v6.3.1/bin/npm" "start"
19 error node v6.3.1
20 error npm v3.10.3
21 error code ELIFECYCLE
22 error [email protected] start: `tsc && concurrently "npm run tsc:w" "npm run lite" `
22 error Exit status 2
23 error Failed at the [email protected] start script 'tsc && concurrently "npm run tsc:w" "npm run lite" '.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the angular2-quickstart package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error tsc && concurrently "npm run tsc:w" "npm run lite"
23 error You can get information on how to open an issue for this project with:
23 error npm bugs angular2-quickstart
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls angular2-quickstart
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
Dank für die super schnelle Antwort. Das hat mein Problem gelöst! – Justin