angular 相关问题

关于Angular的问题(不要与AngularJS混淆),来自Google的Web框架。将此标记用于Angular问题,这些问题并非特定于单个版本。对于较旧的AngularJS(1.x)Web框架,请使用angularjs标记。

在 docker 容器内运行 ngserve

我在 Docker 容器内运行 ngserve 时遇到问题。 我使用 Dockerfile 创建了常规的 Angular 应用程序。 { “名称”:“wwwroot”, “版本”:...

回答 1 投票 0

Abp.io 添加相关实体到租户

我从 abp.io 开始,免费版本。我正在编写一个多租户应用程序,我需要向租户实体添加一个属性,例如商业版本中的“版本”。所以,我读了...

回答 1 投票 0

如何在 Visual Studio 2022 之外启动 Microsoft.AspNetCore.SpaProxy.SpaProxyLaunchManager

我通过 VS 模板在 VS 2022 中创建了“Asp.NET Core 6.0 with Angular”应用程序。 它工作得很好,我可以一键从 VS 启动它。 然后它会打开 2 个命令行窗口和一个浏览器...

回答 1 投票 0

如何使用 MockBuilder(来自 ng-mocks)通过 TranslateTestingModule.withTranslations() 测试 Angular 组件

我正在使用 ng-mocks,想要测试使用翻译的角度组件。 我很想使用 .withTranslation 来尊重语言文件结构。 但我还没有找到通往你的路...

回答 1 投票 0

自定义角度指令在 WebStorm IDE 中不起作用

我创建了一个名为 ngForFlTrackByIndex 的自定义指令,用于在 ngFor 内部使用。在 vscode 中一切都很好,但在 WebStorm 中抱怨需要表达式。 还有指令代码: @指令(...

回答 1 投票 0

如果您的选择器使用 2 个 feautreselector 如何在 ngrx 存储中将它们彼此分开

这是我的选择器,它结合了 2 个功能选择器 导出 const eslectorswaseseftcheserrors = createSelector( 结束不是特征选择器, 结束了没有特色的选择器, 阿斯特斯 => 阿斯特斯。

回答 1 投票 0

找不到管道“翻译”,Angular2组件测试

我正在使用 angular2 进行组件测试。 在我的 html 模板中,我使用翻译管道。 这是测试的代码: 从 '@angular/core/

回答 4 投票 0

找不到模块:错误:无法解析“leaflet.animatedmarker”

我运行了 npm install -S leaflet.animatedmarker 命令。 我的 package.json 文件包含“leaflet.animatedmarker”:“^1.0.0”。但是我无法运行该项目。我的模块不是...

回答 1 投票 0

Angular 两个不同的构建命令生成不同的js文件哈希值

我有最新的角度项目。我在 package.json 中有两个不同的 npm 命令。这两个命令都执行 ng build --output-path=... 并使用 diff... 在不同位置生成构建文件

回答 2 投票 0

我可以设置放大验证器组件的原色吗?

我正在 Angular 中使用放大验证器组件,我想更改颜色。有一个示例显示如何覆盖验证器各个部分的颜色: [数据-a...

回答 1 投票 0

我在屏幕上看到过滤后的数据,但是当我清除输入时,原始数据没有出现

我在屏幕上看到过滤后的数据,但是当我清除输入时,原始数据没有出现 这里我将 _todayShare 在 标签中按顺序显示为一个项目 分享 我在屏幕上看到过滤后的数据,但当我清除输入时,原始数据没有出现 这里我将 _todayShare 标签中的 <a\> 按顺序显示为项目 <span>Share</span> <input [(ngModel)]="sharedsearchText" (keyup)="applyFilter(sharedsearchText)" style="width: 50%; margin-top: 1px; margin-bottom: 1px;" matInput placeholder="Ara..." /> </div> <div class="list" slim-scroll [slimScrollOptions]="{ height: 450 }"> <a *ngFor=" let item of _todayShare | keyvalue : valueAscOrder; let i = index " style="cursor: pointer" class="transition" (click)="showliveRss(item)" > _todayShare 是一张地图,正如您所理解的,我在下面复制了它,但它再次不起作用。 _todayShare: Map<string, any> = new Map<string, any>(); ngOnInit() { this._todayShare = new Map<string, any>(); .... applyFilter(value: string) { const filterValue = value.trim().toLowerCase(); const filteredMap = new Map<string, any>(); const _todayShareBackup = new Map<string, any>(this._todayShare) _todayShareBackup.forEach((item, key) => { if (key.toLowerCase().includes(filterValue) || JSON.stringify(item).toLowerCase().includes(filterValue)) { filteredMap.set(key, item); } }); this._todayShare = filteredMap } 当我清除此处的输入时,我希望所有数据如下 这里的问题是 applyFilter 函数,其中 _todayShare 被过滤结果覆盖,当过滤器被清除时,它不会恢复原始数据,您需要在过滤之前备份原始数据,所以当您重新过滤它不适用于之前过滤的数据,而是适用于原始数据。 export class YourComponent implements OnInit { _todayShare: Map<string, any> = new Map<string, any>(); _originalTodayShare: Map<string, any>; // This will store the original data ngOnInit() { this._todayShare = new Map<string, any>(); this._originalTodayShare = new Map<string, any>(this._todayShare); // Load your _todayShare data here and then make a copy to _originalTodayShare } applyFilter(value: string) { if (!value.trim()) { // If there is no input, restore the original data this._todayShare = new Map<string, any>(this._originalTodayShare); return; } const filterValue = value.trim().toLowerCase(); const filteredMap = new Map<string, any>(); this._originalTodayShare.forEach((item, key) => { if (key.toLowerCase().includes(filterValue) || JSON.stringify(item).toLowerCase().includes(filterValue)) { filteredMap.set(key, item); } }); this._todayShare = filteredMap; } }

回答 1 投票 0

未检查的运行时最后错误,消息端口在收到响应之前关闭

这个问题是在结合 Spring Boot 运行 Angular 项目时出现的。后端没有错误。但在浏览器中运行的角度部分出现错误是“未检查的运行时。

回答 1 投票 0

RXJS 在可能未定义的对象上观察可观察对象

给定两个来源,其中之一可能未定义,我如何组合两者中的最新一个? const observable1 = 间隔(100); const observable2 = this.ref?.observable; // 这是对 angu 的引用...

回答 1 投票 0

Angular 中的跨度中存在间隙,但 AngularJS 中不存在

有 2 个等效的组件模板,其中一个是用 AngularJS 编写的: 有 2 个等效的组件模板,其中一个是用 AngularJS 编写的: <span ng-repeat="status in statusInformation.statusList | filter : whereFilter" class="show-on-hover"> <span class="app-icon app-icon_md soh__trigger" ng-class="status.informationType.iconClass"></span> <span class="soh__content soh__content_multiline app-text_addition-1" ng-bind="status.message"></span> </span> 新的一个是用现代 Angular 编写的: <span *ngFor="let status of statusList" class="show-on-hover"> <span class="app-icon app-icon_md soh__trigger" [ngClass]="appealStatusAdditionalInformationTypesMap[status.informationType].iconClass" ></span> <span class="soh__content soh__content_multiline app-text_addition-1">{{ status.message }}</span> </span> 两者之间的区别在于,在AngularJS中似乎主跨度更大,导致有差距: 而在现代 Angular 中,相同的跨度较小,导致图标之间没有间隙: 生成的html如下(旧的有间隙): <appeal-status-information status-information="rowData.appealStatusAdditionalInformation" applicant-type="rowData.applicantInfo.applicantType" class="ng-isolate-scope"> <!-- ngRepeat: status in statusInformation.statusList | filter : whereFilter --> <span ng-repeat="status in statusInformation.statusList | filter : whereFilter" class="show-on-hover ng-scope"> <span class="app-icon app-icon_md soh__trigger app-icon_cl_prime gis-icon gis-icon-main-response" ng-class="status.informationType.iconClass"></span> <span class="soh__content soh__content_multiline app-text_addition-1 ng-binding" ng-bind="status.message">Response received</span> </span> <!-- end ngRepeat: status in statusInformation.statusList | filter : whereFilter --> <span ng-repeat="status in statusInformation.statusList | filter : whereFilter" class="show-on-hover ng-scope"> <span class="app-icon app-icon_md soh__trigger app-icon_cl_action mdi mdi-20px mdi-thumb-up-outline" ng-class="status.informationType.iconClass"></span> <span class="soh__content soh__content_multiline app-text_addition-1 ng-binding" ng-bind="status.message">Appeal status: Information received</span> </span> <!-- end ngRepeat: status in statusInformation.statusList | filter : whereFilter --> </appeal-status-information> 新的没有: <appeal-status-information> <span class="show-on-hover ng-star-inserted"> <span class="app-icon app-icon_md soh__trigger app-icon_cl_prime gis-icon gis-icon-main-response"></span> <span class="soh__content soh__content_multiline app-text_addition-1">Response received</span> </span> <span class="show-on-hover ng-star-inserted"> <span class="app-icon app-icon_md soh__trigger app-icon_cl_action mdi mdi-20px mdi-thumb-up-outline"></span> <span class="soh__content soh__content_multiline app-text_addition-1">Appeal status: Information received</span> </span> <!----> </appeal-status-information> 如您所见,样式相同,但结果却不同。 旧角度的跨度较大可能是什么原因? <ng-container *ngFor="let status of statusList"> <span class="show-on-hover"> <span class="app-icon app-icon_md soh__trigger" [ngClass]="appealStatusAdditionalInformationTypesMap[status.informationType].iconClass" ></span> <span class="soh__content soh__content_multiline app-text_addition-1">{{ status.message }}</span> </span> </ng-container> 对 ng 使用 ng-container,这样在查看页面时不会使用 html 中的任何空间或高度宽度

回答 1 投票 0

为什么我的代码生成的边界框总是在原点,而不是在鼠标按下时在光标位置渲染?

我正在尝试在三个js渲染上创建一个边界框缩放,用户可以在其中拖动一个框,然后相机将缩放有界区域。但是,该框未正确生成。 ` ...

回答 1 投票 0

在开发 Angular 项目时如何防止表单字段自动填充?

我目前正在使用 Angular 开发一个 Web 应用程序,并且遇到了表单字段自动填充的问题。每当我测试表单时,尤其是在 Chrome 中,浏览器都会自动填充一些

回答 1 投票 0

ion-searchbar 与 FormGroup 仅在插入的值为 minLength (3) 时进行搜索

我正在尝试制作一个在插入的值大于或等于3之前不进行搜索的 但我尝试的方法不起作用 :( 主页.html 我正在尝试制作一个在插入的值大于或等于 3 之前不进行搜索的 但是我尝试的方法没有成功 :( 首页.page.html <form [formGroup]="search"> <ion-searchbar formControlName="ionSearch" [debounce]="500" (ionInput)="handleInput($event)" placeholder="Search product"></ion-searchbar> </form> 首页.page.ts ngOnInit() { this.makeForm(); } makeForm() { this.search = new FormGroup({ ionSearch: new FormControl("", Validators.minLength(3)) }); } 你的意思是这样吗?我只是检查长度是否大于或等于三并执行过滤! handleInput(event) { const query = event.target.value.toLowerCase(); if (query.length >= 3) { this.results = this.data.filter( (d) => d.toLowerCase().indexOf(query) > -1 ); } else { this.results = this.data; } } Stackblitz 演示

回答 1 投票 0

Angular16 MongoDB Http Post 上的多个参数

我需要将两个参数与请求一起传递到我的端点,这样每个我的 http post 请求就可以使用三个参数,并且只允许两个参数。我尝试了 HttpParams 但这不起作用...

回答 1 投票 0

如何使用新的 CanActivateFn 而不是已弃用的 CanActivate 在 Angular auth Guard 中实现由 auth reducer 管理的状态?

//auth.guard.ts 导出类 AuthGuard 实现 CanActivate { 构造函数(私有存储:Store,私有路由器:Router){} canActivate(): 可观察...

回答 1 投票 0

错误 NG8001:“课程”不是已知元素

我想以此作为序言,我已经阅读了这里无数其他问题,这些问题似乎与我得到的问题相同,但它似乎对我根本不起作用。 我正在使用教程来学习。

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.