
[英]How to hide/show a button in a tablerow depending on the data in that row in Angular?
我正在尝试制作一个用户表,其中显示了我的 mongoDb 中的所有用户。 用户可以通过单击表格行内的按钮来关注或取消关注其他用户。 如果当前用户已经关注其中一位用户,我想显示取消关注按钮,反之亦然。 这是 ui 的图像,可以让您更好地理解“volgen”的意思。 图片:用户表我遇到的问题是我在无限 ...
[英]How to hide/show a button in a tablerow depending on the data in that row in Angular?
我正在尝试制作一个用户表,其中显示了我的 mongoDb 中的所有用户。 用户可以通过单击表格行内的按钮来关注或取消关注其他用户。 如果当前用户已经关注其中一位用户,我想显示取消关注按钮,反之亦然。 这是 ui 的图像,可以让您更好地理解“volgen”的意思。 图片:用户表我遇到的问题是我在无限 ...
[英]Angular, ng-templates with if condition
我想根据角色 ID 的变化调用两个单独的模板。 我可以得到我的角色 which role as 两个模板是, 和 ...
[英]how to index with edit button with exact value and then save on index?
单击编辑按钮时出现问题。 它将编辑所有选定的数据。 我需要编辑特定的索引值,但我没有得到那个值。 selectedVtuCommands是所选字符串的数组。 .html 文件<div id="vtu-command-div"> <ul id="selected-comma ...
[英]*ngIf directive in Angular does not refresh the template when the condition is not met
我有一个 angular mat-table,我在其中显示一个带有数据的日历,我想显示一个月中的所有日子或仅显示 2 个两周中的一个,所以我有一个变量来设置我的日历的视觉类型 (vistaCalendario)另一个设置两周 (quincenaurl)。 从这些图标中选择视觉类型 但是这个条件没有得 ...
[英]AngularJS ng-if is not working while the condition is true
我正在为 Coursera AngularJS 单页应用程序使用 angular.min.js 1.8.2。 我创建了一个 itemAdder 来由用户添加购物清单,这些项目将显示在 showList 中。 一旦你购买了物品,你可以点击购买按钮将购买列表放入购买列表。 如果所有的东西都被买了,应该有 ...
[英]*ngIf and optional chaining
我目前正在重构一些旧代码,从而处理许多冗余的条件检查。 这是一个简短的例子: 大多数条目,如“用户年龄”,都是显而易见的,因为我们已经知道用户存在。 封装后的 HTML 标签的使用层次分明。 我关心标签内的顺序。 我可以安全地删除“用户名”中的条件检查吗? ...
[英]angular - ngIf collection of conditions as class
假设我有 10 个<p>元素,我想为它们添加*ngIf条件,如下所示: 有什么办法可以创建这样的“类”: 甚至没有“返回”声明: 然后扭动这样的东西: <p *ngIf="myConditions"> ? 它在长而复杂或长条件的情况下非常有用,尤其是在像我上面的<p& ...
[英]Angular: Using directives with *ngIf
是否可以说如果i >= 2那么[cdkDropListConnectedTo]="[one, two]" ,否则[cdkDropListConnectedTo]="[three, four]" ? *ngIf对我不起作用。 我还搜索了“Angular ngif 指令”。 然而,我要找的答案并 ...
[英]Property 'x' does not exist on type 'y' in Angular ngIf
我正在创建一个 Angular 页面来显示足球比赛的结果,并希望在没有比赛时显示一条警告消息。 我使用 ngIf 检查包含所有匹配项的数组是否与 0 不同,但在 else 中指定要引用的 ng-template 给我一个错误“属性‘noMatch’在类型‘MainPageComponent’上不存 ...
[英]Changing value of mat-option based off a conditonal in *ngIf
当涉及到我的mat-option时,我有两个值选项 我想根据我拥有的两个变量在我的 html 中设置一个条件: public SentDate; public CurrentDate; 我从日期选择器中获取这些值。 我想要的结果是,如果日期相同,如果不显示tempTime ,则在mat-option ...
[英]How can I make var in *ngIf?
我有情况: 我怎样才能从 (items | somePipe) 制作 var 以便不重复相同的代码如果有可能这样做的话: ...
[英]Data not displaying in the HTML file while using the api?
我正在开发购物车应用程序。 我在 cart.component.html 中显示用户选择的产品时遇到问题,因为数据未呈现。 每次都在创建 DOM 但数据未显示在 cart.component.html 中? 谁能建议如何解决这个问题? 购物车.component.html ` 购物车.compo ...
[英]Angular 13 tree Ng For Loop Not working Properly
Angular 树循环不起作用,这是我尝试使用的代码示例。 我是否需要在我的代码中编写任何其他内容才能正常工作? 请帮我解决这个问题。 谢谢你。 我的 HTML 密码 我的 Ts 代码如下 下图将是预期的结果 这是我的 Stackblitz 代码 https://stackblitz.com/ed ...
[英]Cannot do ng for loop binding in angular 13
当重复条目来自数据库时,我想执行 angular 13 循环将数据拆分为一列现在我变成了这样 我想要这样 ...
[英]ion-progress-bar doesn't show correctly when inside a (#loading) ng-template
这是我的第一个问题。 我做了一个 #loading 模板,里面有一个离子进度条,但它没有显示在页面的页脚上(如果我也尝试的话,也不会显示在 header 中)。 它显示在 header 旁边。 后来我尝试了一些方法来避免这个 ng-template,做一个变量 isLoadingActive 和一个 ...
[英]ngIF with interpolation
伙计们,一个简单的代码让我理解了这个指令是如何工作的。 我有一个具有两个功能的 ts 文件: 我有 html: 您注意到我有两个插值,但我想创建一个条件以仅使用一个插值并打印 function 结果 chnageUserCreatedStatus() 或 NouserCreated() 我将不胜感 ...
[英]Angular api response data not displaying in table
我是 angular 的新手,所以遵循 Deborah Kurata 的 angular 入门和反应式 forms 课程。 在课程代码中有一个产品列表组件,它在模板中有一个表,在 model 中调用产品服务来检索 ngOnInit 中的一些数据。 我将此作为我自己的应用程序的示例,在该应用程序中,我 ...
[英]Angular - Display different dropdown values based on condition
如果满足 html 中的以下条件,我会将data值显示为下拉列表。 我想添加另一个条件,在change of another dropdown which contains companies name I show data1 value. For example if 1st dropdown ...
[英]Error when using ngIf on div in a submodule in Angular
我有一个主要使用组件的应用程序,但我创建了自己的子模块,名为ProjectsModule 。 这个ProjectsModule正在使用它自己的路由器等等,但问题是当显示这个模块的特定组件时,我得到:NG0303: Can't bind to 'ngIf' since it isn't a known ...
[英]ngIf still renders div on false condition
我正在尝试根据我的数据中的标志显示一系列材料卡。 如果标志是假的,我仍然会在 DOM 中注入一个空的 div(因此还有额外的空间)。 假设我有一个带有isBanana标志的Fruit对象数组。 我的模板看起来像:<div *ngIf="fruit$ | async as fruits"> ...