3

I am going through a tutorial that requires an import from "nativescript-angular/forms" for binding but I am getting an error that says

Cannot find module 'nativescript-angular/forms' or its corresponding type declarations.ts(2307)

import { NativeScriptFormsModule } from 'nativescript-angular/forms';

How can I fix this?

2 Answers 2

4

Since Nativescript 7, the imports for Angular related modules are updated to @nativescript/angular. The updated version of your code should look something like:

import { NativeScriptFormsModule } from '@nativescript/angular';
Sign up to request clarification or add additional context in comments.

Comments

0

It's because a lot of the imports has been changed since NativeScript 8, not just Angular related modules.

You can solve it by replacing the imports that you have in your code with:

import { NativeScriptFormsModule } from '@nativescript/angular';

Or

  • Just delete it, then reimport it by deleting and rewriting the last character of the class name, or just use the shortcuts defined on your IDE.
  • if you are installing the needed module, you will get a suggestion just where you used that class. this is a silly solution, but I use it all the time, it's going to save you a lot of time, so you don't have to look at the right imports on the internet.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.