ng-modules 相关问题


Angular 17 中的 NG 块 UI

我尝试在 Angular 17 中使用 NG Block UI 并收到此错误 ng block ui error in Angular 17 知道这个模块在 Angular 17 中如何工作吗? 提前致谢 我使用 npm i ng-


Python 中多元核密度估计的条件采样

可以使用以下命令创建多元核密度估计 (KDE): scikitlearn(https://scikit-learn.org/stable/modules/ generated/sklearn.neighbors.KernelDensity.html#sklearn.neighbors.KernelDensity...


尝试在因斯布鲁克生成 PCF 时引发问题

生成正确的PolicyCenter Innsbruck .jar文件(C:/Guidewire/policycenter/modules/configuration/build/libs/pc-configuration-50.9.0.jar)后,我尝试生成以下页面对象.. .


无需封闭标签的角度内容投影

有没有一种方法可以实现不包含标签的内容投影? 这是我的组件: 有没有一种方法可以实现不包含标签的内容投影? 这是我的组件: <div class="flex flex-column container"> <div class="flex flex-column header"> <ng-content select="[header]"></ng-content> </div> <div class="flex flex-column body"> <ng-content></ng-content> </div> <div class="flex flex-column footer"> <ng-content select="[footer]"></ng-content> </div> </div> 请注意,有两个可能的插槽 header 和 footer。这些组件应该这样使用: <div header>Header</div> Body <div footer>Footer</div> 如果没有这个div我该如何使用这个组件?我的意思是,我只想添加内容,因为如果我添加 div,它可能会破坏布局。 您可以尝试在 ngProjectAs 标签上使用 ng-container 属性: <ng-container ngProjectAs="[header]">Header</ng-container> Body <ng-container ngProjectAs="[footer]">Footer</ng-container> 更多相关内容请参见 Angular 文档


如何在 Ng Prime 菜单栏中设置菜单项的样式?

我刚刚开始使用 ng prime,我使用了 p 菜单栏 这是组件文件: 这个.items = [ { 标签:“第一项...


通过 ng-bind-html 使用插入的 HTML 中的函数

我从数据库中获取了一个 HTML 字符串,我想通过 ng-bind-html 将其插入到我的 AngularJs 应用程序中。我是这样做的: HTML: <... 我从数据库中获取了一个 HTML 字符串,我想通过 ng-bind-html 将其插入到我的 AngularJs 应用程序中。我是这样做的: HTML: <div ng-bind-html="myBindHtml"></div> JavaScript: $scope.myBindHtml = $sce.trustAsHtml(htmlStringToInsert); 我的 HTML(我想插入)看起来像这样: <button ng-click="testClickEvent()">TestButton</button> 插件工作正常。 现在我编写了一个按钮应该调用的函数(testClickEvent)。这只是将一个字符串输出到控制台。 但这部分不起作用。我猜想我插入的 HTML 与该函数没有绑定。有什么办法可以调用我的函数吗? Angular 代码仅当您在 Angular 上下文中运行时才会执行。当您使用 ng-bind-html 时,它会在 Angular 上下文之外生成,因此像 ng-click 这样的 Angular 事件不起作用,您需要依赖像 onclick 这样的纯 JS 事件,因此请避免使用这些场景,而直接在 Angular 上进行编码,因为解决方案的复杂性! 当需要角度事件并且我们需要直接在前端编码而不是从数据库或其他方法输入时,我们可以避免ng-bind-html var app = angular.module('myApp', []); app.controller('myCtrl', function ($sce, $scope) { $scope.items = []; for (var i = 1; i <= 2; i++) { $scope.items.push({ description: $sce.trustAsHtml('<h2 onclick="console.log(\'hello\')">with onclick item ' + i + '</h2>') }); }; $scope.items2 = []; for (var i = 1; i <= 2; i++) { $scope.items.push({ description: $sce.trustAsHtml('<h2 ng-click="console.log(\'hello\')"> with ng-click item ' + i + '</h2>') }); }; }); <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.8.3/angular.min.js" integrity="sha512-KZmyTq3PLx9EZl0RHShHQuXtrvdJ+m35tuOiwlcZfs/rE7NZv29ygNA8SFCkMXTnYZQK2OX0Gm2qKGfvWEtRXA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <div ng-app="myApp"> <div ng-controller="myCtrl"> <div> <div ng-repeat="item in items" ng-bind-html="item.description"></div> </div> <hr /> <div> <div ng-repeat="item in items2" ng-bind-html="item.description"></div> </div> </div> </div>


如何使用 wasm-bindgen 和 --target no-modules 导入 JavaScript 函数?

我正在尝试弄清楚如何使用 Rust 和 wasm-bindgen 调用 JavaScript 函数。由于缺乏浏览器支持,我无法将 wasm-bindgen 与 ES6 模块与 Web Worker 一起使用。 到目前为止...


Angular“ng 生成组件”复制组件

由于某种原因,自从从 Angular 13 升级到 Angular 15 后,当我输入: ng g c 某些组件 Angular 复制组件,创建重复文件。这种情况 100% 都会发生。第二次...


使用 :host ::ng-deep 设置 CSS 角色到角度组件 CSS 不起作用?

尝试使用以下方法设置角度组件的 CSS prop :host ::ng-deep .p-dropdown-panel { 变换原点:中心底部!重要; 顶部:-119px!重要; 左:0!重要; } ...


Expo 项目错误:配置项目 ':expo-modules-core' 时出现问题

几个月前我正在开发一个项目,当时它正在工作,现在我再次克隆了该存储库并执行了所有步骤,例如 npm install 然后 npx expo run:android 但我收到这个错误 甚至...


:主机 ::ng-deep 未将样式应用于材质复选框

我正在尝试为材质多选做一个简单的复选框背景颜色更改。 我尝试过两者都做 .mat-pseudo-checkbox-checked { 背景颜色:#a9a9a9 !重要; } 和 :主持人::ng-de...


运行 ionicserve 我收到此错误:“[错误] ng 意外关闭(退出代码 127)。”

我正在尝试在我的 Mac 上运行 ionic 应用程序。当我运行 npm install 来安装依赖项时,一切正常,没有任何问题。 但是当我运行 ionicserve 或 ionics 时,我收到此错误 [ng] 沃...


将嵌套元素放入 ng-content

我尝试用一个获得所有。 一个 直接位于父元素的根 DOM 中,另一个位于 内部 帕...


禁用按钮时的角度显示工具提示

<button [disabled]="(!dataConceptSummmaryFlag || dataConceptSummmaryFlag === false) && (!selectedLOBFlag || selectedLOBFlag === false) && (!adsListFlag || adsListFlag === false)" class="lmn-btn lmn-btn-primary" aria-label="Update" (click)="updateSelectedScopes()" [mtTooltip]="disabledContent" > Update </button> <ng-container *ngIf="(!dataConceptSummmaryFlag || dataConceptSummmaryFlag === false) && (!selectedLOBFlag || selectedLOBFlag === false) && (!adsListFlag || adsListFlag === false)"> <ng-template #disabledContent>No New Scopes Values Selected</ng-template> </ng-container> 如果在该条件下禁用按钮,如何在悬停时显示工具提示文本,并且当我将鼠标悬停在其上时,我会看到红色关闭图标。这是我尝试过的,但没有成功 将此添加到覆盖材质样式的文件中: // this workaround allows for the tooltips to appear on disabled buttons (since mouse events aren't fired for them) button:disabled.mat-mdc-tooltip-trigger { pointer-events: auto !important; // remove the ripple effect on hover > span:first-child { display: none; } } 悬停时它将显示没有波纹背景的工具提示。


如何让新的 Angular 17 项目运行?

全新安装 Nodejs (20.10.0) 和 Angular (17.0.8)。新项目(“ng new Default”),没有文件更改。 “ngserve”没有错误,但浏览器控制台显示: main.ts:5 错误


Angular 项目不适用于@babylonjs/viewer

我在全球安装了@Angular/[email protected]。我使用命令行“ng new BabylonTest --routing false --style css --skip-git --skip-tests”创建了一个 Angular 项目。 CD 到文件夹“Babyl...


如何以数组形式提交,只有id。使用 Angular 7 和 ng-multiselect-dropdown

我提交此表格: 让 newRole = this.addForm.value console.log(this.addForm) 形式如图所示: 当我把 console.log(this.addForm.value) 显示为 我只想提交


Angular 12:Firebase 模块未正确提供(?)

第一次使用Firebase,所以我不知道发生了什么。我没有修改使用 ng add @angular/fire 获得的配置,所以我的 AppModule 中的内容是: @NgModule({ 声明:[


Angular 材质选项卡 - 响应式选项卡更改

我在 mat-tab-group 中有两个选项卡: 我在 mat-tab-group 中有两个选项卡: <mat-tab-group animationDuration="0ms" [disablePagination]="false" mat-stretch-tabs="false" mat-align-tabs="start" > <mat-tab label="First tab"> <ng-template matTabContent> <app-first-tab /> </ng-template> </mat-tab> <mat-tab label="Second tab"> <ng-template matTabContent> <app-second-tab /> </ng-template> </mat-tab> </mat-tab-group> 在第一个选项卡上,我生成了很多组件,因此需要一些时间才能完全渲染。 当我选择第二个选项卡并返回第一个选项卡时,应用程序会冻结(几秒钟),直到所有内容都呈现出来。 是否可以显示例如。标题(它的更多-更少的静态),一些微调器,当所有内容都渲染时,隐藏微调器?或者让用户以某种方式知道发生了什么事? 示例:https://stackblitz.com/edit/stackblitz-starters-sb2saw ..仅用于测试目的。 非常感谢。 您遇到的问题有两个部分: 您的异步请求的模拟实际上是使用同步函数(for循环),该函数在访问服务时正在运行。这不是标准 Observable 在野外的工作方式,也是选项卡之间漫长等待的根源。 您可以利用容器和模板在加载异步变量时显示加载微调器。 HTML 示例: <ng-container *ngIf="data$ | async as data; else loading"> <table> <thead> <th>ID</th> <th>Code</th> <th>Buttons</th> </thead> <tbody> <tr *ngFor="let item of data"> <td>{{ item.id }}</td> <td>{{ item.code }}</td> <td> @for (idx of buttonCount; track idx; let index = $index) { <button>{{ idx }}</button> } </td> </tr> </tbody> </table> </ng-container> <ng-template #loading><mat-spinner></mat-spinner></ng-template> 更新了服务以更好地模拟异步数据(也可以作为 Observable 共享): async fetchData(): Promise<ApiModel[]> { let result: ApiModel[] = []; for (let i = 1; i <= this.cnt; i++) { result.push({ id: i, code: `item_${i}` }); } return new Promise((resolve, reject) => { setTimeout(() => resolve(result), Math.random() * 5000); }); } 结果是立即交换选项卡,在加载数据时显示一个微调器图标: StackBlitz 叉子链接


角度 *ngIf; else 在异步上,当未定义是来自 Observable 的有效值时

我正在尝试使用 *ngIf; else 上的可观察对象可以发出未定义的信号。这是我所拥有的 我正在尝试使用 *ngIf; else 上的可观察对象可以发出未定义的信号。这是我有的 <span *ngIf="(content$ | async) as content; else loading"> <span *ngIf="content != undefined; else notFound"> // show content </span> </span> 问题在于,如果observable的值未定义,页面会一直显示#loading,并且不会切换到#notFound 有没有办法接受 undefined(可以改为 null)作为有效的输出值,并让 UI 在不同阶段显示相应的部分? 因为 Boolean(undefined) 的计算结果为 false,内部条件 content !== undefined 始终为 true 并且 notFound 永远不会加载。 您将需要更改您的应用程序逻辑。 处理此类场景的最简单方法似乎是使用 ngrxLet : <ng-container *ngrxLet="content$ as content; suspenseTpl: loading"> <span *ngIf="!content"> <h2>Not found!</h2> </span> <span *ngIf="content"> {{ content }} </span> </ng-container> <ng-template #loading> Loading... </ng-template>


PrimeNg 选项卡视图选项卡选择

在 prime ng 的 tabview 文档的可关闭部分中,我看到当我删除最后一个选项卡时,它会转到第一个选项卡。我的问题是:我怎样才能让它转到左侧的选项卡而不是......


向垫子表添加额外的行

所以我有一张垫子桌 所以我有一张垫子桌 <mat-table class="table" cdkDropList cdkDropListOrientation="horizontal" (cdkDropListDropped)="tableDrop($event)" [dataSource]="tableDataSource"> <ng-container *ngFor="let column of columns; let i = index" [matColumnDef]="column.name"> <mat-header-cell *matHeaderCellDef cdkDrag dkDragLockAxis="x" cdkDragBoundary="mat-header-row"> {{ column.title }} </mat-header-cell> <mat-cell *matCellDef="let element"> {{ element[column.name] }} </mat-cell> </ng-container> <mat-header-row class="tableHeader" *matHeaderRowDef="tableDisplayedColumns" #tableHeaderRow> </mat-header-row> <mat-row class="tableRow" *matRowDef="let row; columns: tableDisplayedColumns;" [class.selected-row]="tableSelectedRows.has(row)" (click)="selectUnselectRow(row)"> </mat-row> </mat-table> 但我需要在表标题下为相应的行过滤器添加一行。我尝试在标题和实际行声明之间添加 <mat-row> ,但是由于过滤器是不同的输入(例如数字、自动完成选择和多选),我无法 *ngFor 它们(而且我不是当然我是否能够) 编辑:忘记发布过滤器 HTML <div class="filterGroup"> <mat-form-field class="filterField"> <input matInput type="number" (keydown)="updateManualPage(1)" placeholder="Filter za param1" formControlName="filterParam1"> </mat-form-field> <mat-form-field class="filterField"> <input matInput (keydown)="updateManualPage(1)" placeholder="Filter za param2" formControlName="filterParam2" [matAutocomplete]="autoSingleSelect"> <mat-autocomplete #autoSingleSelect="matAutocomplete" class="filterSelect" panelClass="filterSelect"> <mat-option *ngFor="let option of dropdownSingleFilteredOptions | async" [value]="option.param2"> {{option.param2}} </mat-option> </mat-autocomplete> </mat-form-field> <mat-form-field class="filterField"> <mat-select class="filterMultiselect" placeholder="Filter za param3" formControlName="filterParam3" multiple panelClass="filterMultiselect"> <mat-option *ngFor="let option of tableDataSource.data" [value]="option.param3"> {{option.param3}} </mat-option> </mat-select> </mat-form-field> </div> 以及相关组件.ts tableDisplayedColumns: string[] = ['param1', 'param2', 'param3']; columns: any[] = [ { name: 'param1', title: 'Param1' }, { name: 'param2', title: 'Param2' }, { name: 'param3', title: 'Param3' } ]; 为了解决这个问题,我设法通过删除 *ngFor 并手动放入过滤器来做到这一点。 <mat-table class="table" cdkDropList cdkDropListOrientation="horizontal" (cdkDropListDropped)="tableDrop($event)" [dataSource]="tableDataSource"> <ng-container matColumnDef="param1"> <mat-header-cell *matHeaderCellDef cdkDrag cdkDragLockAxis="x" cdkDragBoundary="mat-header-row" [cdkDragStartDelay]="100"> Param1 <mat-form-field class="filterField"> <input matInput type="number" (keydown)="updateManualPage(1)" placeholder="Filter" formControlName="filterParam1"> </mat-form-field> </mat-header-cell> <mat-cell *matCellDef="let data"> <span>{{data.param1}}</span> </mat-cell> </ng-container> <ng-container matColumnDef="param2"> <mat-header-cell *matHeaderCellDef cdkDrag cdkDragLockAxis="x" cdkDragBoundary="mat-header-row" [cdkDragStartDelay]="100"> Param2 <mat-form-field class="filterField"> <input matInput (keydown)="updateManualPage(1)" placeholder="Filter" formControlName="filterParam2" [matAutocomplete]="autoSingleSelect"> <mat-autocomplete #autoSingleSelect="matAutocomplete" class="filterSelect" panelClass="filterSelect"> <mat-option *ngFor="let option of dropdownSingleFilteredOptions | async" [value]="option.param2"> {{option.param2}} </mat-option> </mat-autocomplete> </mat-form-field> </mat-header-cell> <mat-cell *matCellDef="let data"> <span>{{data.param2}}</span> </mat-cell> </ng-container> <ng-container matColumnDef="param3"> <mat-header-cell *matHeaderCellDef cdkDrag cdkDragLockAxis="x" cdkDragBoundary="mat-header-row" [cdkDragStartDelay]="100"> Param3 <mat-form-field class="filterField"> <mat-select class="filterMultiselect" placeholder="Filter" formControlName="filterParam3" multiple panelClass="filterMultiselect"> <mat-option *ngFor="let option of tableDataSource.data" [value]="option.param3"> {{option.param3}} </mat-option> </mat-select> </mat-form-field> </mat-header-cell> <mat-cell *matCellDef="let data"> <span>{{data.param3}}</span> </mat-cell> </ng-container> <mat-header-row class="tableHeader" *matHeaderRowDef="tableDisplayedColumns" #tableHeaderRow> </mat-header-row> <mat-row class="tableRow" *matRowDef="let row; columns: tableDisplayedColumns;" [class.selected-row]="tableSelectedRows.has(row)" (click)="selectUnselectRow(row)"> </mat-row> </mat-table>


更改动态表单控制角度的值

我有这个动态表单控件 我有这个动态表单控件 <form [formGroup]="dynamicFormGroup" (ngSubmit)="onSubmit()" > <div class="row" formArrayName="address" *ngFor="let fields of AddressInfo.controls; let i = index"> <ng-container [formGroupName]="i"> <input type="number" class="form-control height-reset" placeholder="Enter Mobile" name="mobile" formControlName="mobile" /> .. </form> 当我尝试更改字段的值时 this.dynamicFormGroup.controls['mobile'].setValue(''); 或 this.dynamicFormGroup.patchValue({ mobile: '444' }); 该值未更新 任何解决方案谢谢 我认为问题在于您在 formGroup 内的 FormArray 内使用 FormControl。 (只需查看简短的代码片段即可) 所以你的代码应该看起来像这样; this.dynamicFormGroup.controls[index].controls['mobile'].setValue(''); <ng-container [formGroupName]="i">也可能会破坏它。 我建议修改表格的结构,然后找到每个表格的正确“路径”。 就您而言,不清楚 AddressInfo 是什么。相反,将您的代码更改为: <div class="row" formArrayName="address" *ngFor="let fields of addressFormArray.controls; let i = index"> <ng-container [formGroupName]="i"> <input type="number" class="form-control height-reset" placeholder="Enter Mobile" name="mobile" formControlName="mobile"> </ng-container> </div> get addressFormArray() { return this.formMain.get('address') as FormArray; } 用户现在可以添加值。 如果您计划以编程方式编辑该值,则 this.dynamicFormGroup.controls['mobile'].setValue(''); 将不起作用,因为 mobile 是 FormArray 中的 FormControl。然后,要么循环遍历该数组以更改所有值,要么必须澄清应该更改哪个值。


ng-multiselect-dropdown 在选择下拉列表中的第二个项目时关闭

在这个下拉菜单中,选择第一个项目(pune)后,当我单击第二个项目(新德里)进行选择时,下拉菜单被关闭,它是多选下拉菜单。以下是我的设置 下拉设置= {


如何解决奇数编号的 Node.js 版本不会进入 LTS 状态且不应用于生产节点:16120 UnhandledPromiseRejectionWarning

我尝试创建一个新的角度应用程序ng新应用程序,但出现此错误 检测到 Node.js 版本 v11.0.0。 奇数编号的 Node.js 版本不会进入 LTS 状态,并且不应用于产品...


ng-bootstrap 滚动间谍在没有高度的情况下无法工作?

我在我的项目中使用 ng-bootstrap [ngbScrollSpy] 指令,如文档中所述,但它不起作用 - 滚动时活动项目不会改变。 我的代码如下: 我在我的项目中使用 ng-bootstrap [ngbScrollSpy] 指令,如文档中所述,但它不起作用 - 滚动时活动项目不会改变。 我的代码如下: <div> <div class="sticky-top"> <ul class="nav menu-sidebar"> <li > <a [ngbScrollSpyItem]="[spy, 'about']">About</a> </li> <li > <a [ngbScrollSpyItem]="spy" fragment="schedule">Schedule</a> </li> <li > <a [ngbScrollSpyItem]="spy" fragment="hotel">Information about the hotel</a> </li> </ul> </div> <div ngbScrollSpy #spy="ngbScrollSpy" > <section ngbScrollSpyFragment="about"> <h3>About</h3> <p>{{some long long text and content}}</p> </section> <section ngbScrollSpyFragment="schedule"> <h3>Schedule</h3> <p>{{some long long text and content}}</p> </section> <section ngbScrollSpyFragment="hotel"> <h3>Information about the hotel</h3> <p>{{some long long text and content}}</p> </section> </div> </div> 我在这个 stackoverflow 问题中看到,我的问题是我没有向我的 div 提供 height,这是事实。 但我的滚动间谍部分遍布整个页面,而不是一个小 div,(导航本身是 sticky-top)。所以我不能给它高度。 我知道有替代方法 - 刷新窗口滚动上的滚动间谍,但我没有找到可以帮助我的正确代码。 你能解决我的问题吗? 为我提供刷新滚动间谍的代码/给我有关高度的提示/帮助我找到另一个相应的元素。 非常感谢! 附上 stackblitz 演示的链接 注意:我使用来自 @ng-bootstrap/ng-bootstrap 的 NgbScrollSpy (我想它是非常相似的库) 我做什么: 我将所有内容(包括导航)包装在中 <div class="wrapper" ngbScrollSpy #spy="ngbScrollSpy" rootMargin="2px" [threshold]="1.0" > <div class="sticky-top pt-4 pb-4 bg-white"> ..here the navigation... </div> ..here the sections... <section ngbScrollSpyFragment="about"> </section> //the last I use margin-bottom:2rem; <section ngbScrollSpyFragment="hotel" style="margin-bottom:10rem" </section> </div> 见“门槛”。这表明“更改”活动片段应该可见的百分比(1 是 100%) 包装类 .wrapper{ height:100%; position: absolute; top:0; } 我使用强制链接的类别 //remove all the class for the link a{ color:black; text-decoration:none; padding:8px 16px; } a.custom-active{ color:white; background-color:royalblue } 以及我使用的每个链接 <a [class.custom-active]="spy.active=='about'">About</a> 嗯,问题是如何“滚动到”。 “链接”应该作为链接使用。 第一个是指示“路由器”应该考虑“碎片” 如果我们的组件是独立组件,我们需要使用提供者,provideRouter bootstrapApplication(App, { providers: [ provideRouter([], withInMemoryScrolling({anchorScrolling:'enabled'})), ] }) 然后,我们需要考虑到我们的页面确实没有滚动,div“包装器”是谁拥有滚动。因此,我们订阅 router.events,当事件有“锚点”时,我们滚动“包装器”div constructor(router: Router) { router.events.pipe(filter((e:any) => e.anchor)).subscribe((e: any) => { (document.getElementById('wrapper') as any).scrollTop+= (document.getElementById(e.anchor)?.getBoundingClientRect().top||0) -72; //<--this is the offset }); } 在这个stactblitz中你有一个有效的例子


如果类型是从变量进行数据绑定,则通过 <object> 标签在 Angular 中显示 pdf 无法在 Chrome 中工作

我正在尝试通过 标签在 Chrome 中显示 pdf。 如果我手动编写类型,它会起作用: 不工作 但是... 我正在尝试通过 <object> 标签在 Chrome 中显示 pdf。 如果我手动写 type: 就可以了 <object [data]="getUrl(true)" type="application/pdf"> Not working </object> 但如果我从变量读取类型则不会: <object [data]="getUrl(true)" [type]="file.mimeType"> Not working </object> 为什么?这是一些非常奇怪的错误,还是我做错了什么可怕的事情。 这里是plunkr。 它可以在 Firefox 中运行(所有 4 个对象都会显示),但不能在 Chrome 中运行 (Version 74.0.3729.169 (Official Build) (64-bit)): 我遇到了同样的问题,但我不明白原因。 就我而言,我决定在基于 Blink 引擎的浏览器中使用“embed”元素而不是“object”元素。 <ng-template #blinkPlatformViewer> <embed [src]="getUrl(true)" [type]="file.mimeType"/> </ng-template> <object *ngIf="!isBlinkPlatform; else blinkPlatformViewer" [data]="getUrl(true)" [type]="file.mimeType"> Not working </object> import { Platform } from '@angular/cdk/platform'; import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'; export class FileContentComponent { constructor(private readonly sanitizer: DomSanitizer, private readonly platform: Platform) { } get isBlinkPlatform(): boolean { return this.platform.BLINK; } }


更改垫输入的波纹颜色

我现在一直在努力了解如何手动更改元素的波纹颜色,但我似乎无法让它以任何方式工作。 我现在一直在努力研究如何手动更改 <mat-input> 元素的波纹颜色,但我似乎无法让它以任何方式工作。 <input matInput type="number" (keydown)="updateManualPage(1)" placeholder="Filter" formControlName="filterParam1"> 我已经尝试了CSS中我能想到的一切,.mat-form-field-underline,.mat-form-field-ripple,包括我使用::after和::before选择器从另一个SO问题/答案中无耻地撕掉的一大块类,尝试使用 ::ng-deep、!important,但似乎没有任何东西可以改变从 @import "../node_modules/@angular/material/prebuilt-themes/indigo-pink.css"; 导入的蓝色波纹的颜色 编辑:只需更好地阅读 API,所以我发现波纹后出现的边框颜色来自 <mat-form-field> 元素,该元素有一个颜色选择器。但是,该颜色选择器只能具有“primary”、“accent”和“warn”值。所以现在我想知道如何插入自定义颜色。 设法弄清楚了,原来如此 ::ng-deep .mdc-text-field--filled:not(.mdc-text-field--disabled) .mdc-line-ripple::after { border-bottom-color: *X* !important; }


在 Angular 中打开模态时出现ExpressionChangedAfterItHasBeenCheckedError

` `<ngx-datatable-column *ngIf="search_type ==='booking'" [width]="50" [sortable]="false" [canAutoResize]="false" [draggable]="false" [resizeable]="false"> <ng-template ngx-datatable-cell-template let-row="row" let-value="value"> <span class="fa fa-user-plus font-medium-3 text-primary cursor-pointer pl-1" (click)="onUpdateBookingLinguist(row)"></span> </ng-template> </ngx-datatable-column>` 上面是我的html代码,下面是我的ts代码 ` onUpdateBookingLinguist(linguist: Linguist) { const modalRef = this.modalService.open(ScheduledBookingModalComponent, { size: 'lg' }); modalRef.componentInstance.linguist_other_bookings = linguist['scheduled_booking']; modalRef.result.then((result) => { if (!result) { return; } this.cdr.detectChanges(); }).catch((e) => { }); this.cdr.detectChanges(); }` 我试图从 ngx-datatable-column 打开模式,但收到此错误 错误错误:NG0100:ExpressionChangedAfterItHasBeenCheckedError:表达式在检查后已更改。上一个值:“datatable-body-cell sort-active active”。当前值:'datatable-body-cell sort-active'.. 欲了解更多信息,请访问 https://angular.io/errors/NG0100 我尝试使用 ChangeDetectorRef.detectChanges() 手动触发更改检测,但仍然收到错误。 当您修改 Angular 在其更改检测周期期间也尝试检查或更新的属性时,通常会出现此错误。 因此您可以使用 ChangeDetectorRef 在特定情况下手动触发更改检测。通过从 ChangeDetectorRef 调用 detectorChanges(),您可以手动指示 Angular 对该组件及其子组件重新运行更改检测,从而可能解决问题 这是如何在组件中使用ChangeDetectorRef 的示例 构造函数(私有 cdr:ChangeDetectorRef){} ngAfterContentChecked() { this.cdr.detectChanges(); }


NG8001:“app-welcome”不是已知元素:

我的 Angular 应用程序遇到问题,收到错误 8001。我不知道如何处理它。谁能帮我这个?谢谢你! 应用程序组件.html {{标题}}&l... 我的 Angular 应用程序遇到问题,收到错误 8001。我不知道如何处理它。谁能帮我这个?谢谢! app.component.html <h1>{{ title }}</h1> <p>Congratulations! Your app is running. 🎉</p> <app-welcome></app-welcome> app.component.ts import { Component } from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterOutlet } from '@angular/router'; @Component({ selector: 'app-root', standalone: true, imports: [CommonModule, RouterOutlet], templateUrl: './app.component.html', styleUrl: './app.component.css' }) export class AppComponent { title = 'XYZCARS'; } welcome.component.ts import { Component } from '@angular/core'; @Component({ selector: 'app-welcome', templateUrl: './welcome.component.html', styleUrl: './welcome.component.css' }) export class WelcomeComponent { car = 'toyota'; } 我的项目最初没有 app.module.ts 文件。我自己添加了它并根据网上找到的一些信息进行了配置,但问题仍然存在并且仍未解决。谁能帮我解决这个问题吗? app.module.ts import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { WelcomeComponent } from './welcome/welcome.component'; import { AppComponent } from './app.component'; @NgModule({ declarations: [ AppComponent, WelcomeComponent ], imports: [ BrowserModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { } 如果您正在 Angular 17 中创建项目->使用这些命令 ng app --no-standalone 然后你就得到了 app.module.ts 文件。


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