我已经创建了这个 Angular 库,现在我想在其他 Angular 应用程序中使用它,但我似乎在对等依赖项方面遇到了麻烦。我尝试在我的应用程序的 package.json 中摆弄,但似乎无法消除任何错误。
我尝试过的(按顺序):
以下是错误:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: lib-test@0.0.0
npm ERR! Found: @angular/common@13.0.3
npm ERR! node_modules/@angular/common
npm ERR! @angular/common@"~13.0.0" from the root project
npm ERR! peer @angular/common@"^13.0.0 || ^14.0.0-0" from @angular/cdk@13.2.2
npm ERR! node_modules/@angular/cdk
npm ERR! @angular/cdk@"^13.2.0" from the root project
npm ERR! peer @angular/cdk@"^13.0.0" from @my-group/angular-lib@1.1.4
npm ERR! node_modules/@my-group/angular-lib
npm ERR! …Run Code Online (Sandbox Code Playgroud) 我想知道是否可以传递一个函数作为验证器。我尝试过,但没有结果。
Widget Field(String changedValue, String label, bool isTextObscured) {
return TextFormField(
decoration: InputDecoration(labelText: label),
validator: checkFieldEmpty,
);
}
checkFieldEmpty(String fieldContent) {
if(fieldContent.isEmpty) {
return 'Ce champ est obligatoire.';
}
return null;
}
Run Code Online (Sandbox Code Playgroud)