Nativescript Angular 找不到模块 "nativescript-angular/forms"

Nativescript Angular cannot find module "nativescript-angular/forms"

我正在阅读一个教程,该教程需要从“nativescript-angular/forms”导入以进行绑定,但我收到一条错误消息

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

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

我该如何解决这个问题?

从 Nativescript 7 开始,Angular 相关模块的导入更新为 @nativescript/angular。您的代码的更新版本应该类似于:

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