Skip to content

fix: add dependency on @angular/forms #15133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"@angular/animations": "0.0.0-NG",
"@angular/cdk": "0.0.0-PLACEHOLDER",
"@angular/core": "0.0.0-NG",
"@angular/common": "0.0.0-NG"
"@angular/common": "0.0.0-NG",
"@angular/forms": "0.0.0-NG"
},
"dependencies": {
"tslib": "^1.7.1"
Expand Down
2 changes: 2 additions & 0 deletions src/lib/schematics/ng-add/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ describe('ng-add schematic', () => {
expect(dependencies['@angular/material']).toBeDefined();
expect(dependencies['@angular/cdk']).toBeDefined();
expect(dependencies['hammerjs']).toBeDefined();
expect(dependencies['@angular/forms']).toBe(angularCoreVersion,
'Expected the @angular/forms package to have the same version as @angular/core.');
expect(dependencies['@angular/animations']).toBe(angularCoreVersion,
'Expected the @angular/animations package to have the same version as @angular/core.');

Expand Down
5 changes: 3 additions & 2 deletions src/lib/schematics/ng-add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ export default function(options: Schema): Rule {
// of the CLI project. This tag should be preferred because all Angular dependencies should
// have the same version tag if possible.
const ngCoreVersionTag = getPackageVersionFromPackageJson(host, '@angular/core');
const angularDependencyVersion = ngCoreVersionTag || requiredAngularVersionRange;

// In order to align the Material and CDK version with the other Angular dependencies,
// we use tilde instead of caret. This is default for Angular dependencies in new CLI projects.
addPackageToPackageJson(host, '@angular/cdk', `~${materialVersion}`);
addPackageToPackageJson(host, '@angular/material', `~${materialVersion}`);
addPackageToPackageJson(host, '@angular/animations',
ngCoreVersionTag || requiredAngularVersionRange);
addPackageToPackageJson(host, '@angular/forms', angularDependencyVersion);
addPackageToPackageJson(host, '@angular/animations', angularDependencyVersion);

if (options.gestures) {
addPackageToPackageJson(host, 'hammerjs', hammerjsVersion);
Expand Down