当我构建 Angular 12 项目时,出现以下错误:
错误:初始超出最大预算。预算 5.00 MB 未达到 197.06 kB,总计 5.19 MB
我的 angular.json:
"budgets": [
{
"type": "initial",
"maximumWarning": "4mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
Run Code Online (Sandbox Code Playgroud)
但我仍然有错误。
我该如何解决这个问题?
感谢。
在我的 ASP.NET Core-6 Web API 中,我安装了这个 NuGet 包:
<PackageReference Include="microsoft.aspnetcore.mvc.versioning.apiexplorer" Version="5.0.0" />
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
namespace WebApi.API.V1
{
[ExcludeFromCodeCoverage]
internal static class ApiStartup
{
public static void AddMyApi(this IServiceCollection services)
{
services.AddHealthChecks();
services.AddControllers()
.AddControllersAsServices()
.SetCompatibilityVersion(CompatibilityVersion.Version_3_0)
.AddJsonOptions(c =>
c.JsonSerializerOptions.PropertyNamingPolicy
= JsonNamingPolicy.CamelCase);
}
}
}
Run Code Online (Sandbox Code Playgroud)
我收到这些错误:
警告 ASP5001“CompatibilityVersion”已过时:“此 API 已过时,将在未来版本中删除。考虑删除用法。
警告 CS0618“CompatibilityVersion.Version_3_0”已过时:“此 CompatibilityVersion 值已过时。”
警告 ASP5001 'MvcCoreMvcBuilderExtensions.SetCompatibilityVersion(IMvcBuilder, CompatibilityVersion)' 已过时:'此 API 已过时,将在未来版本中删除。考虑删除用法。
怎么解决呢?
谢谢
我正在使用 Angular-7 开发一个应用程序。在应用程序中,我使用了 Angular 材料的mat stepper. 问题是,如何隐藏mat-stepper标题,如下图所示。我根本不想让它出现。
<mat-horizontal-stepper>
<mat-step label="transaction">
<button mat-button matStepperNext>Next</button>
</mat-step>
<mat-step label="personal">
<button mat-button matStepperPrevious>Previous</button>
<button mat-button matStepperNext>Next</button>
</mat-step>
</mat-horizontal-stepper>
Run Code Online (Sandbox Code Playgroud)
在我的 windows-10 中,我安装了:
Nodejs-v16.13.0
npm-v8.1.0
当我尝试运行 npm install -g @angular/cli 时
我收到这个错误:
npm 错误!代码 ERR_INVALID_URL
npm 错误!无效的网址
我如何获得这个决心?
谢谢
在 Angular-13 中,我试图实现更改密码。它有 ASP.NET Core Web API 作为后端。
我有这些代码:
授权服务:
mustChangePassword(NewPassword:string, ConfirmNewPassword:string){
const data = {
NewPassword:NewPassword,
ConfirmNewPassword:ConfirmNewPassword
}
return this.http.post(this.baseUrl + 'auth/change-password', data);
}
Run Code Online (Sandbox Code Playgroud)
组件.ts:
export class ChangePasswordComponent implements OnInit {
changePasswordForm!: FormGroup;
isLoading = false;
isSubmitted = false;
constructor(
private authService: AuthService,
private router: Router,
private toastr: ToastrService,
private fb: FormBuilder
) {
}
ngOnInit(): void {
this.createForm();
}
createForm() {
const formOptions: AbstractControlOptions = { validators: MustMatch('NewPassword', 'ConfirmNewPassword') };
this.changePasswordForm = this.fb.group({
NewPassword: ['', [Validators.required, Validators.minLength(6), Validators.maxLength(80)]], …Run Code Online (Sandbox Code Playgroud)