我创建了这个名为country-flag-dropdown.ts和html的组件 成分: 从“@angular/core”导入{Component、OnInit、Input、Output、EventEmitter}; 导入 {FormGroup, FormControl} ...
我有两个组件:主页组件和产品列表组件。 这是我的 home.component.ts: 从 '@angular/core' 导入 { Component } ; 从“@angular/core”导入{NgModule}; 导入{产品...
我的 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 文件。
我有这个角度组件,似乎使 TrustPilot 小部件在硬刷新后消失,任何人都可以解释为什么吗? 从 '@angular/core' 导入 { Component, Input, OnInit }; 宣告全球...
选中/取消选中 mat-checkbox 未正确返回 true 或 false
我正在使用 Angular 15 和 Angular Material 14,下面是我用来显示复选框列表的 HTML 代码 我正在 Angular 15 和 Angular Material 14 工作,下面是我用来显示复选框列表的 HTML 代码 <div *ngFor="let control of checkboxArray.controls;let i = index" > <mat-checkbox [formControl]="control" (input)="validateInputs(notificationForm)" [checked]="control.value" (change)="control.checked=$event.checked;onCheckedChange(i);"> {{ checkboxItems[i].name }} </mat-checkbox> </div> 下面是Angular中onCheckedChange函数的代码 onCheckedChange(index: number) { this.sortCheckboxArray(); const checkboxItem = this.checkboxItems[index]; const control = this.checkboxArray.at(index); if (control) { if (control.value) { this.lists.push(checkboxItem.id.toString()); } else { this.lists.pop(checkboxItem.id.toString()); } } this.updateSubscriberGroupsCount(); this.cdr.detectChanges(); } 当我选中复选框时,在这个 onCheckedChange 函数中,control.value 始终返回 false。哪里出了问题?无法理解.. 这是一个工作版本,复选框逻辑工作正常,希望有帮助! 我们需要使用control.value获取表单组,但我们还需要访问内部表单控件,然后获取复选框值! import { CommonModule } from '@angular/common'; import { Component } from '@angular/core'; import { FormArray, FormControl, FormGroup, ReactiveFormsModule, } from '@angular/forms'; import { bootstrapApplication } from '@angular/platform-browser'; import 'zone.js'; import { MatCheckboxModule } from '@angular/material/checkbox'; @Component({ selector: 'app-root', standalone: true, imports: [CommonModule, ReactiveFormsModule, MatCheckboxModule], template: ` <form [formGroup]="form"> <div formArrayName="array"> <div *ngFor="let control of checkboxArray.controls;let i = index" [formGroupName]="i"> <mat-checkbox formControlName="test" style="margin-bottom: 15px;" (change)="onCheckedChange(i);"> {{ checkboxItems[i].name }} </mat-checkbox> </div> </div> </form> `, }) export class App { name = 'Angular'; form = new FormGroup({ array: new FormArray([]), }); lists = []; checkboxItems: any = []; ngOnInit() { this.add(); this.add(); this.add(); } add() { this.checkboxArray.push( new FormGroup({ test: new FormControl(false), }) ); this.checkboxItems.push({ name: 'test' }); } get checkboxArray() { return this.form.get('array') as FormArray; } onCheckedChange(index: number) { // this.sortCheckboxArray(); // const checkboxItem = this.checkboxItems[index]; const control = this.checkboxArray.at(index); if (control) { if (control.value.test) { console.log('checked'); // this.lists.push(checkboxItem.id.toString()); } else { console.log('not checked'); // this.lists.pop(checkboxItem.id.toString()); } } // this.updateSubscriberGroupsCount(); // this.cdr.detectChanges(); } } bootstrapApplication(App); 堆栈闪电战
我正在尝试将路由添加到我的 tabView 但它不起作用,请问有什么建议吗?我尝试添加 routerLink="组件路径" 但没有运气 这是 HTML 我正在尝试将路由添加到我的 tabView 但它不起作用,请问有什么建议吗?我尝试添加 routerLink="组件路径" 但没有运气 这是html <p-tabView> <p-tabPanel header="Weather Data" routerLink="/weather-data"> <app-weather-data></app-weather-data> </p-tabPanel> <p-tabPanel header="Chart"> <app-chart></app-chart> </p-tabPanel> <p-tabPanel header="Heat index calculator" closable="true"> <app-heat-index></app-heat-index> </p-tabPanel> </p-tabView> 这是 module.ts import { RouterModule, Routes } from '@angular/router'; const appRoutes: Routes = [ { path: 'weather-data', component: WeatherDataComponent }, { path: 'chart', component: ChartComponent }, { path: 'heat-index', component: HeatIndexComponent }, ]; @NgModule({ declarations: [ AppComponent, WeatherDataComponent, ChartComponent, HeatIndexComponent, ], imports: [ BrowserModule, TabViewModule, ButtonModule, ChartModule, TableModule, HttpClientModule, InputNumberModule, FormsModule, SelectButtonModule, DropdownModule, BrowserAnimationsModule, FontAwesomeModule, InputSwitchModule, PaginatorModule, ReactiveFormsModule, RouterModule.forRoot(appRoutes), ], providers: [DatePipe], bootstrap: [AppComponent], }) export class AppModule {} 我找不到有关 tabView 组件的任何有关如何实现路由的文档,感谢任何帮助 我按以下方式使用了 TabMenu 组件。 <p-tabMenu [model]="items"> </p-tabMenu> <router-outlet></router-outlet> MenuItem 类型有一个命令属性,在命令上您可以实现自定义操作,在您的情况下可以是路由。 this.items = [ { label: "Map", icon: "pi pi-fw pi-map", command: () => { this.router.navigate(["./map"]) }, }, ];
我正在研究Oracle内部结构,我想知道文档中所说的“B树索引”实际上是经典的B树还是B+树? 我认为是一棵B+树,因为所有数据节点...
next.js 14 错误:无法读取未定义的属性(读取“get”)”
官方示例https://github.com/vercel/next.js/tree/canary/examples/next-forms在createTodo时出现错误“Error: Cannot readproperties of undefined (reading 'get')”。但是……
我已经关注了https://github.com/wax911/Vision-Barcode-Scanner/tree/master/barcode-reader/app/src/main/java/com/google/android/gms/samples这个git将 Vision api 实现到我的应用程序中。我...
Haskell do 表示法在 Scala 中没有等效的 for 理解?
考虑以下构建平衡二叉树的 Haskell 代码: 数据树 a = 节点 a (树 a) (树 a) |空的 构建 :: Int -> [(Tree Char, Int)] 构建 n = 执行 让 k = (n - 1) `div` 2...
从 Angular 16 转换为 Angular 17 后缺少 SSR 支持
我已将我的项目从 Angular 16 升级到 Angular 17。但是,我目前没有收到服务器端渲染 (SSR) 的支持。从 Angular 16 迁移后,Angular 是否提供 SSR 支持...
Spring MVC - 为什么我在 GET 请求中需要模型对象?
看一下 Spring 提供的用于处理表单提交的示例: https://github.com/spring-guides/gs-handling-form-submission/tree/main/complete 这是 Spring MVC 控件的基本示例...
findAncestorsTree 在 TypeORM 3 中不返回父级
我正在使用TypeORM物化树。有一个称为组织的实体,每个组织都有一个父级,并且可以有多个子级。 @Entity('组织') @Tree('物化路径') 出口
Angular CLI 版本与 Angular Core 版本之间的兼容性?
有什么方法可以知道要安装哪个与我的 Angular Core 版本兼容的 Angular CLI 版本?他们完全独立吗? 使用 Core v5.2.8 开发现有的 Angular 应用程序...
我有一个带有选择器的多输入组件,如下所示: 我有一个带有选择器的多输入组件,如下所示: <app-input type="currency" formControlName="currency"></app-input> <app-input type="date" formControlName="dateOfBirth"></app-input> 因此,从该组件中,我有一个像这样的选择器: @Component({ selector: 'app-input[type=currency]', }) @Component({ selector: 'app-input[type=date]', }) 现在,我想添加多个 currency 组件。一种用于默认货币成分,第二种用于具有动态货币符号的货币。 所以,我想通过选项让它变得不同。当选择器有选项时,显示带动态符号的货币,否则或默认,显示不带符号的默认货币。 我一直在尝试使用下面的这个选择器,但它不起作用。 对于默认货币: @Component({ selector: 'app-input:not([options])[type=currency]', }) 对于动态符号货币: @Component({ selector: 'app-input[options][type=currency]', }) 提前谢谢您 您可以像这样添加数据属性来区分选择器 无符号: @Component({ selector: 'app-input[type=currency]', }) 带有符号: @Component({ selector: 'app-input[type=currency][data-symbols]', }) html with symbols: <app-input type="currency" formControlName="currency" data-symbols></app-input> without symbols: <app-input type="currency" formControlName="currency"></app-input>
安装 Angular CLI 时出现 Npm Angular 警告
当我尝试通过以下方式安装 CLI 时收到 npm 警告: npm install -g @angular/cli: C:\Users\myuser>npm install -g @angular/[email protected] npm 警告已弃用 [email protected]:此模块...
我尝试在 Angular 17 中使用 NG Block UI 并收到此错误 ng block ui error in Angular 17 知道这个模块在 Angular 17 中如何工作吗? 提前致谢 我使用 npm i ng-
我研究了一些地方。他们说:更高的基数可以减少搜索深度。为什么? 我很好奇如果 B 树有许多相同的值会是什么样子? 我期待有关 b 树如何创建的详细信息...
无法将用于生产的 AppDbContext 设置替换为用于集成测试的内存数据库
我在我的 github 存储库中制作了一个最小化代码来说明问题:https://github.com/suugbut/MiniTest/tree/main。 我正在学习集成测试来测试我的最小 api。我无法取代
Angular Material v17:缺少“MatFormFieldAppearance”中的“遗产”
在 Angular Material v14 中,MatFormFieldAppearance 提供了传统、标准、填充和轮廓值。 类型 MatFormFieldAppearance = '旧版' | '标准' | '填充' | '大纲'; 然而,在 Angular
由于某种原因,自从从 Angular 13 升级到 Angular 15 后,当我输入: ng g c 某些组件 Angular 复制组件,创建重复文件。这种情况 100% 都会发生。第二次...
我有几个 Angular 应用程序在 nx 工作区中运行。所有这些应用程序都使用 Angular Material 对话框。为此,我通常创建这样的 Angular 服务: 导入 { 管理组件 }
angular-2-dropdown-multiselect - 自定义宽度 100%
我正在实现这个 angular-2-dropdown-multiselect 组件: https://www.npmjs.com/package/angular-2-dropdown-multiselect 该组件工作正常,但我需要将其设置为适合续...
我的 Angular 项目有问题。我有一个项目结构:应用程序结构。在我的 app.module.ts 中,代码如下: 从'@angular/core'导入{NgModule}; 从'@
Angular 项目不适用于@babylonjs/viewer
我在全球安装了@Angular/[email protected]。我使用命令行“ng new BabylonTest --routing false --style css --skip-git --skip-tests”创建了一个 Angular 项目。 CD 到文件夹“Babyl...
使用模块联盟进行 Angular 升级 - “集合没有原理图。”
我正在将一组 Angular 应用程序从 v12 升级到 v16,它们使用模块联合和 Angular Architects 的模块联合插件。 成功升级每个应用程序的 Angular 版本后...
我在Nextjs Project中使用Balkan的家谱库。
// edit-form.ts import FamilyTree from "@/plugins/balkan-family-tree/familytree"; import editUI = FamilyTree.editUI; export class EditForm implements editUI { constructor() { } content(id: string | number, detailsMode: boolean, dontAnim: boolean, width: string, dontRenderButtons: boolean): string { return ""; } on(type: "show" | "save" | "cancel" | "element-btn-click" | "button-click" | "hide", listener: (sender: FamilyTree.editUI, args: any, args1: any, args2: any) => (void | boolean)): any { return undefined; } setAvatar(avatarUrl?: string): void { } hide(): void { console.log('hide...'); } init(obj: FamilyTree): void { console.log('init...: ', obj); } show(id: string | number, detailsMode?: boolean, dontAnim?: boolean): void { console.log('show...: ', id, detailsMode, dontAnim); } }
Node Sass 版本 9.0.0 与 ^4.0.0 不兼容
我的应用程序中没有安装node-sass或sass包。但我一直收到这个错误 ./src/scss/styles.scss 中的错误(./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plu...
我正在使用以下文档学习放大器 https://docs.amplify.aws/angular/start/getting-started/installation/ https://docs.amplify.aws/angular/start/getting-started/setup/ 但同时
我正在尝试创建一个快捷方式,该快捷方式仅在用户选中复选框时才会创建。 我试图创建一个属性 我正在尝试创建一个快捷方式,只有当用户选中复选框时才会创建该快捷方式。 我尝试创建一个属性 <Property Id ="INSTALLDESKTOPSHORTCUT" Secure="yes" /> 然后我创建了一个复选框,它将更改此属性的值。 <Control Id="InstallShortcutCheckbox" Type="CheckBox" X="20" Y="140" Width="200" Height="17" Property="INSTALLDESKTOPSHORTCUT" CheckBoxValue="1" Text="Do you want to create a start menu shortcut?" /> 然后我添加了快捷方式标签 <Component Id="DesktopShortcut" Condition="INSTALLDESKTOPSHORTCUT"> <CreateFolder/> <RegistryKey Root="HKCU" Key="Software\Secops Solutions, Inc\Agent\Install" > <RegistryValue Name="DTSC" Value="1" Type="integer" KeyPath="yes"/> </RegistryKey> <Shortcut Id="DesktopShortcut" Directory="DesktopFolder" Name="Life Balance" WorkingDirectory="INSTALLFOLDER" Icon="icon" Target="DesktopFile"/> </Component> 我还尝试使用广告快捷方式,其中我使用了两个组件,它们都有不同的条件,例如 if Condition = "INSTALLDESKTOPSHORTCUT" 还有另一个 Condition = "NOT INSTALLDESKTOPSHORTCUT" 但这也不起作用。 所以我一直在尝试解决这个问题,我在 orca 编辑器中看到了快捷方式,但它仍然没有创建快捷方式。 我解决了问题。 <Component Id="DesktopShortcut" Condition="INSTALLDESKTOPSHORTCUT"> <CreateFolder/> <RegistryKey Root="HKCU" Key="Software\Secops Solutions, Inc\Agent\Install" > <RegistryValue Name="DTSC" Value="1" Type="integer" KeyPath="yes"/> </RegistryKey> <Shortcut Id="DesktopShortcut" Directory="DesktopFolder" Name="Life Balance" WorkingDirectory="INSTALLFOLDER" Icon="icon" Target="DesktopFile"/> </Component> 在这段代码中我必须更改目标如下 <Component Id="DesktopShortcut" Condition="INSTALLDESKTOPSHORTCUT"> <CreateFolder/> <RegistryKey Root="HKCU" Key="Software\Secops Solutions, Inc\Agent\Install" > <RegistryValue Name="DTSC" Value="1" Type="integer" KeyPath="yes"/> </RegistryKey> <Shortcut Id="DesktopShortcut" Directory="DesktopFolder" Name="Life Balance" WorkingDirectory="INSTALLFOLDER" Icon="icon" Target="[#DesktopFile]"/> </Component> 在此只需将目标更改为 Target=[#DesktopFile] 这是文件的 id。
我正在声明其他元素类型应该满足的“父”COMPONENT 类型。如果我在普通的 .ts 或 .tsx 文件中使用下面的代码,它可以正常工作(也就是说,它会显示我无法使用...
登录后,使用 angular-oauth2-oidc 时,hasValidAccessToken 始终为 true
我已经使用 Angular 12.2 实现了 angular-oauth-oidc (版本 12.1.0)。我使用 Keycloak 作为 SSO 登录没有问题,但我在库中遇到了奇怪的行为。 每次,之后...
React Router 与 React 16.6 Suspense “提供给 `Route` 的 `object` 类型的道具 `component` 无效,预期为 `function`。”
我正在使用最新版本(16.6)的React和react-router(4.3.1),并尝试使用React.Suspense进行代码分割。 虽然我的路由工作正常并且代码确实分成了几个bun...
通过Angular到Springboot访问POST失败但GET成功,Postman适用于GET和POST
我正在使用示例 Angular 应用程序来测试 Okta 与 springboot 应用程序的集成。 前端示例:https://github.com/okta-samples/okta-angular-sample 我有一个带有
当我尝试在 Angular 17 应用程序中添加软件包时,它无法安装该软件包。它总是显示下面给出的错误。 ng 添加@angular/fire 跳过安装:软件包已安装 更新
我有这个 YAML 文件 src/main/resources/foo.yml: 酒吧: - 你好 - 世界 巴兹: - 洛雷姆 - ipsum 这个组件: @成分 公共类我的组件{ 公共我的组件(地图 我有这个 YAML 文件 src/main/resources/foo.yml: bar: - hello - world baz: - lorem - ipsum 这个组件: @Component public class MyComponent { public MyComponent(Map<String, List<String>> foo) { // foo.get("bar") } } 使用 Spring Boot 2.7,是否可以将配置按原样(自己的文件,无前缀,无类)注入到构造函数中? 你可以这样做 @Configuration public class MyConfiguration { @Bean public Map<String, Object> foo(@Value("classpath:foo.yaml") Resource yaml) { Yaml yaml = new Yaml(); return yaml.load(yaml.getInputStream()); } } @Component public class MyComponent { public MyComponent(@Qualifier("foo") Map<String, Object> foo) { ... } }
使用 jquery javascript 搜索 jstree 节点
我正在使用 jstree 插件来构建我的树。我的网页中有一个搜索框,我需要用户能够在其中搜索 jstree 节点。 我正在使用 jstree 插件来构建我的树。我的网页中有一个搜索框,我需要用户能够在其中搜索 jstree 节点。 <fieldset id="search"> <input type="text" name="search_field" id="search_field" value="" /> <button id="search_tree">Search</button> </fieldset> 单击搜索时,jstree 节点应展开,如果找到,节点应突出显示。如果未找到,则应向用户显示错误,如“未找到”。我的代码用于展开下面的所有节点。有没有简单的方法来搜索jstree中的所有节点? <script type="text/javascript"> $(document).ready(function(){ $("#search_tree").click(function () { var value=document.getElementById("search_field").value; $("#tree").jstree("search",value); }); $("#tree").jstree({ "xml_data" : { "ajax" : { "url" : "jstree.xml" }, "xsl" : "nest" }, "themes" : { "theme" : "classic", "dots" : true, "icons" : true }, "search" : { "case_insensitive" : true, "ajax" : { "url" : "jstree.xml" } }, "plugins" : ["themes", "xml_data", "ui","types", "search"] }); }); </script> 我收到此错误: Instances[...] 为 null 或不是对象。这是一个 jstree 错误。有什么想法吗? 我已将这段代码添加到我的函数中: "search" : { "case_insensitive" : true, "ajax" : { "url" : "jstree.xml" } }, "plugins" : ["themes", "xml_data", "ui","types", "search"] 和 创建了此功能并与我的单击按钮相关联: function myFunction() { $(document).ready(function(){ var value=document.getElementById("search_field").value; $("#search_tree").click(function () { $("#tree").jstree("search",value) }); }); } 2023年,API逐年变化。使用版本v3.3.x, 这是我的工作代码: 创建jstree实例,配置如下: 当您搜索关键字时,请使用:
类型“string”无法分配给类型“FormGroup<any>”Angular 14 错误
我是一名初学者 Angular 开发人员,我正在使用本教程构建一个 todoList 应用程序 -> https://www.youtube.com/watch?v=WTn2nVphSl8 它是使用 Angular 13 完成的。我遇到错误的是我...
Angular 在其文档中声明,它与所有主要浏览器的 2 个最新版本(以及 Firefox 的最新+ESR)兼容。由于 Angular 在底层使用标准 DOM API,因此它应该...
为什么 Angular 2 或 Angular 4 使用香蕉括号?有什么具体原因吗?为什么它们不遵循与 Angular 1 相同的模式?
我知道,它与任何编码无关,但它们可以遵循与 AngularJS 中相同的语法 有角度...
Angular Material 17 独立组件中没有 DateAdapter 的提供者
我有一个带有 Angular 17 应用程序的 nx 项目,并尝试使用带有材料 17.0.4 的 Angular 材料日期选择器。但我明白了 NullInjectorError:没有 DateAdapter 的提供者! 错误。组件...
应用程序无法识别手势,例如在 Angular 11 中使用 Hammer.JS 进行平移
我无法在使用 Hammer.JS 的 Angular 应用程序中识别任何手势,例如滑动、平移。它的设置是这样的: 包.json: “@角度/核心”:“11.0.5”, “@Angular/platform-br...
我按照这个例子来实现角度材料表。 https://stackblitz.com/angular/jejeknenmgr?file=src%2Fapp%2Ftable-basic-example.ts 在这里,我使用...
我创建了一个新的 nx Angular monorepo,并在尝试使用此代码查看环境变量时 导出类 AppComponent 实现 OnInit { ngOnInit() { console.log(process.env); } ...
有人知道 Mule 4 相当于下面的 Mule 3 代码吗? 有人知道 Mule 4 相当于下面的 Mule 3 代码吗? <expression-component doc:name="TECH_Heroku_PartKey"><![CDATA[ payload=com.google.common.hash.Hashing.sha1().hashBytes(payload.getBytes("UTF-8")); ]]></expression-component> hashWith()可以在DataWeave 2中使用不同算法生成哈希,包括SHA1。 您需要注意,结果可能会根据有效负载的不同而有所不同。我猜测在 Mule 3 中你正在将 Java 字符串转换为字节。在 Mule 4 中,hashWith() 函数需要一个二进制文件。你会测试一下。 或者,您可以将相同的代码放入 Java 方法中并使用 Java 模块调用它。
我是最近的 Angular 用户,我有一个 Angular 17 项目,带有传单地图。 当我尝试构建该项目时,传单地图的 3 个图像(标记图标和图层)出现 3 个错误: 是否...
全新安装 Nodejs (20.10.0) 和 Angular (17.0.8)。新项目(“ng new Default”),没有文件更改。 “ngserve”没有错误,但浏览器控制台显示: main.ts:5 错误
为什么我的应用程序根目录在 Angular 中不是 100% 高度?
这是我的第一个 Angular 项目,我对 Web 开发还很陌生。我正在使用 Angular 17.0.9。 我希望我的应用程序为 100%,但应用程序根标签始终是可能的最小高度 当你...
如何配置 Angular 17 开发服务器将 HTTP 重定向到 HTTPS?
我已将 Angular 开发服务器配置为成功使用带有 SSL 的 HTTPS: “端口”:4200, “ssl”:正确, "sslKey": "./tools/.ssl/localhost+2-key.pem", “SSL...
我已将 Angular 版本 8、9、10 升级到 16。收到此错误 NG8001:“mat-icon”不是已知元素
我已将 Angular 版本 8、9、10 升级到 16。在 Angular 16 版本上面临以下问题。我已经导入了模块文件中的所有材质模块。然后它也会给出错误。