angularjs 相关问题

用于关于开源JavaScript框架AngularJS(1.x)的问题。不要将此标记用于Angular 2或更高版本;相反,使用[angular]标签。

在 AngularJS 标签中使用变量

要使用 ng-repeat 创建列表的 URL 链接,我应该如何使用 location.href 中的变量? 要使用 ng-repeat 创建列表的 URL 链接,我应该如何在 location.href 中使用变量? <ul ng-repeat="item in items"> <button type="button" class="btn btn-success me-1" onclick="location.href='/view-panel/{{ item.url}}'"> no: {{item.no}} </button> </ul> 我尝试过,但没有成功。请告诉我更好的方法。 像这样使用ng-click HTML <button type="button" class="btn btn-success me-1" ng-click="navigateToPanel(item.url)"> 代码 $scope.navigateToPanel = function(itemUrl) { location.href =`/view-panel/${ itemUrl }`; };

回答 1 投票 0

降级在 angularjs 上下文中使用的角度组件不会渲染

我遵循了大多数文章和 SO 帖子,以实现准备迁移的 angularJS 应用程序的基本/标准引导。 从“@angular/core”导入{DoBootstrap,NgModule}; 导入 {

回答 1 投票 0

NullInjectorError:R3InjectorError [ToastrService - > ToastrService - > InjectionToken ToastConfig - > InjectionToken ToastConfig]:

当我在主模块组件中添加 ngx-toastr ProvideToast() 时,我陷入了在 angualr 16 的角度独立微前端中添加 ngx-toastr 的困境。请检查下面的屏幕截图: 谢谢 输入我...

回答 1 投票 0

Ionic 5 Angular ...如何使用守卫跳过登录页面以及如何启动设备

我有一个 ionic 5 项目。 成功登录并关闭应用程序后 再次打开应用程序后显示 1 秒登录页面,然后重定向到路由页面,我的情况是主页 如何预防...

回答 1 投票 0

如何使用 Angular js 从数据库中删除元素

我目前正在练习 Angular 并从它开始,我也在做一个 MEAN 堆栈应用程序,并且我正在尝试创建一个删除函数以便从数据库中删除一个元素,但它是......

回答 1 投票 0

用数组初始化 Angular 范围变量

我正在为我的应用程序使用 AngularJS。我正在将 json 格式的数据传递到 Web API。我在将复选框中的多个选定值从 Angular 控制器传递到 WebAPI 时遇到问题。 这是我的

回答 1 投票 0

可以将 Angular 路由器配置为在单击具有本地 href 的锚点时更新 Angular 路由吗?

我正在将 angularjs 应用程序转换为 Angular 9 应用程序。我们的代码的一部分是一个内容管理系统,它加载在其他地方编写和存储的 HTML。此 HTML 包含

回答 1 投票 0

Ng-Zorro 与 Bootstrap 冲突

我创建了一个搜索栏,其中包括放大镜和清除按钮(“X”符号)。 HTML: 我创建了一个搜索栏,其中包括放大镜和清除按钮(“X”符号)。 HTML: <div class="search-container"> <input class="search-Input form-control custome-search-input dark-placeholder" aria-labelledby="search-label" id="search-input" autofocus="true" placeholder="Search" type="search" > <label class="search-icon search-icon-placeholder" for="search-input" id="search-label"> <svg width="20" height="20" class="search-Search-Icon" viewBox="0 0 20 20"> <path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path> </svg> </label> </div> CSS: .search-container { position: relative; display: inline-block; } .search-icon { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); cursor: pointer; } .search-Input:not(:placeholder-shown) + .search-icon-placeholder { display: none; } 但是,当我将代码集成到我的 Angular 项目中时,出现了放大镜,但缺少清除按钮。我已确定安装在我的项目中的 Ng Zorro 正在干扰 type="search" 功能。 是否有任何解决方法可以启用清除按钮而不完全禁用 Ng Zorro 或诉诸 Ng Zorro 的搜索栏?我的目标是有选择地禁用此特定输入字段的 Ng Zorro 或强制其显示清除按钮。 谢谢你 我们可以使用模板添加X按钮,然后我们可以在关闭按钮下方添加放大镜图标,请参阅以下工作示例供您参考! import { Component } from '@angular/core'; @Component({ selector: 'nz-demo-input-allow-clear', template: ` <nz-input-group [nzSuffix]="inputClearTpl"> <input type="text" nz-input [(ngModel)]="inputValue" placeholder="input with clear icon" /> </nz-input-group> <ng-template #inputClearTpl> @if (inputValue) { <span nz-icon class="ant-input-clear-icon" nzTheme="fill" nzType="close-circle" (click)="inputValue = null" ></span> } <svg style="margin-left: 5px;" width="20" height="20" class="search-Search-Icon" viewBox="0 0 20 20"> <path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path> </svg> </ng-template> `, }) export class NzDemoInputAllowClearComponent { inputValue: string | null = null; textValue: string | null = null; } Stackblitz Demo

回答 1 投票 0

npm 错误!代码 CERT_HAS_EXPIRED - Angular 13

我已经安装了 Angular,它向我显示了版本和所有内容。但是当我尝试运行命令 npm start 时,它给了我错误。我已经卸载并重新安装了所有内容,但这个问题没有解决...

回答 2 投票 0

通知权限总是被拒绝

我正在使用Notification.permission来检查浏览器是否允许通知。 以下是我在代码中检查Notification.permission的方法: // 让我们检查一下浏览器是否支持

回答 1 投票 0

我正在使用角材质matInput matFormfield和matselect,但它没有在屏幕上显示

首先,我手动添加垫子组件,一开始它可以工作,但后来我使用 bard 根据我给出的模式编写其余的代码,然后我开始复制和粘贴...

回答 1 投票 0

Angular 如何获取onselect事件

我正在智能表组件中显示一些数据(使用角度)。最后一列是一个选择元素。我想要做的是插入“选择”更改事件并对数据执行某些操作

回答 2 投票 0

Froala Editor 在清理文本编辑器时不会删除图像

我使用 Froala 制作 HTML 文件并将其存储在服务器中。我在 Angular 1 中使用 Froala 模块。 当我添加页面时,我有一个按钮可以清理 Froala 编辑器,但是当我点击它时,所有的一切都......

回答 1 投票 0

为什么当改变浏览器窗口时div元素没有扩展到原始大小?

这是 HTML 这是 HTML <div class="analysis-area"><div class="chart-wrapper"><div class="chart-panel"><p-chart #pAccuracyChart type="bar" [data]="accuracyChartData" width="500px" height="100%" [responsive]="true" [options]="accuracyChartOptions"></p-chart></div> <div class="accuracyChart"> <p-chart #pAccuracyChart type="bar" [data]="accuracyChartData" width="500px" height="100%" [responsive]="true" [options]="accuracyChartOptions"></p-chart> </div> </div> <div class="table-wrapper"> <div class="data-table"></div> <div class="staticalTbl">/div> </div> 这是CSS .analysis-area{ height: 100%; width: 100%; display: flex; flex-direction:column; .chart-wrapper{ width: 100%; flex: 1; display: flex; flex-direction: row; .chart-panel{ width: 50%; height: 100%; } .accuracyChart{ width: 50%; height: 100%; } } .table-wrapper{ width: 100%; height: 40%; display: flex; flex-direction: row; .data-table{ height: 100%; width: 50%; } .staticalTbl{ height: 100%; width: 50%; } } } 父 div 包含一个分析区域,其中包含 chart-wrapper 和 table-wrapper 元素。 chart-wrapper 包含两个 PrimeNG 图表。 当浏览器窗口大小发生变化时,chart-wrapper 应展开,并且 table-wrapper 应占据剩余空间。 使用p-chart时出现问题。当我缩小时,图表会变大,因为 chart-wrapper 正在扩大,但 p-chart 的高度不会改变。 但是,如果我使用具有属性 div 和 width: 100% 的空 height: 100% 元素,则没有问题。 缺少关闭 div 标签: <html> <head> <title>Page Title</title> <style> .analysis-area{ height: 100%; width: 100%; display: flex; flex-direction:column; .chart-wrapper{ width: 100%; flex: 1; display: flex; flex-direction: row; .chart-panel{ width: 50%; height: 100%; } .accuracyChart{ width: 50%; height: 100%; } } .table-wrapper{ width: 100%; height: 40%; display: flex; flex-direction: row; .data-table{ height: 100%; width: 50%; } .staticalTbl{ height: 100%; width: 50%; } } } *{ border:1px solid gray; } </style> </head> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> <div class="accuracyChart"> <p-chart #pAccuracyChart type="bar" [data]="accuracyChartData" width="500px" height="100%" [responsive]="true" [options]="accuracyChartOptions"></p-chart> </div> <div class="table-wrapper"> <div class="data-table"></div> <div class="staticalTbl"></div> </div> </body> </html>

回答 1 投票 0

应用程序中用于 HTML 文件标签的通用日期格式

我正在更新 Angular 中的应用程序。 我想将日期的格式设置为应用程序的通用值。 换句话说,我希望将格式设置为字符串,存储为常量 som...

回答 2 投票 0

Ng 更新在旧节点版本中不起作用

我正在为我的项目将 Angular 7 升级到 15。我正在一一进行。但我必须手动进行。我的 ng 更新在任何情况下都不起作用。它说您正在使用节点版本 12.13.0请...

回答 1 投票 0

需要读取某个时区的纪元时间,然后将其转换为用户时区

我有 2 个网络应用程序,其中 1 个在云上是“主”,我需要将第二个网络应用程序“子”中的日期与之匹配。 Master(第一个网络应用程序,云)正在 IST、亚洲/加尔各答显示从 sql 读取的日期

回答 2 投票 0

Angular 17 与 Nebular 使用独立组件

我只是看了一下 Angular,我们将它与 Nebular 一起用于 UI,所以我想我应该尝试让一个快速的应用程序开始探索并熟悉。 安装 Angular 后,我创建了一个新应用程序...

回答 1 投票 0

CSS 类未完全应用于 span 元素内的按钮

span 中的样式部分不起作用。 我正在尝试在按钮上设置 CSS 组件。 总共有三个按钮,其中两个在我要求之前就已经存在了。 CSS 类成功...

回答 2 投票 0

转换为不同时区的数据和时间格式

在jsp页面中从日期选择器中选择日期时,格式如下。 从印度登录时,日期选择器格式如下: 字符串 datestr = "2014 年 1 月 1 日星期三 00:00:00...

回答 1 投票 0

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