假设我有两个页面: 客户端页面
商品页面
在两个页面中我都有一个“添加”按钮,是否可以创建一个快捷键,例如ctrl + A将单击“添加”按钮,ctrl + B将用于提交,ctrl + E用于新实体?
我希望当值隐藏标签NAN使用*ngIf*,但它不工作。
标记的标签是变量的默认值,一旦输入被填充,该值将是一个数字,我希望仅在不包含该值时显示标签 NAN
尝试了什么
// undefined
<mat-hint *ngIf="this.cost_liter !== 'undefined'" >cost/liter: {{this.cost_liter}}</mat-hint>
// 'undefined'
<mat-hint *ngIf="this.cost_liter !== 'undefined'" >cost/liter: {{this.cost_liter}}</mat-hint>
//!=
<mat-hint *ngIf="this.cost_liter != undefined" >cost/liter: {{this.cost_liter}}</mat-hint>
//!== NAN
<mat-hint *ngIf="this.cost_liter !== NAN" >cost/liter: {{this.cost_liter}}</mat-hint>
//!= NAN
<mat-hint *ngIf="this.cost_liter != NAN" >cost/liter: {{this.cost_liter}}</mat-hint>
//!== null
<mat-hint *ngIf="this.cost_liter !== null" >cost/liter: {{this.cost_liter}}</mat-hint>
// != null
<mat-hint *ngIf="this.cost_liter != null" >cost/liter: {{this.cost_liter}}</mat-hint>
Run Code Online (Sandbox Code Playgroud)
我确定ngIf可以正常工作,因为我设置了一个条件,如果该值大于0。它可以工作,但仍然不是我的需要
// > 0
<mat-hint *ngIf="this.cost_liter != null" >cost/liter: {{this.cost_liter}}</mat-hint>
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用npm run start命令运行 angular 项目,但出现此错误:
找不到模块@angular/compiler-cli/src/tooling`。
以下是结果ng --version:
Angular CLI: 7.0.7
Node: 12.14.1
OS: win32 x64
Angular: 7.0.4
Run Code Online (Sandbox Code Playgroud)
包.json
@angular-devkit/architect 0.10.7
@angular-devkit/build-angular 0.1000.4
@angular-devkit/build-optimizer 0.1000.4
@angular-devkit/build-webpack 0.1000.4
@angular-devkit/core 7.0.7
@angular-devkit/schematics 7.0.7
@angular/cdk 7.3.2
@angular/cli 7.0.7
@angular/compiler-cli 7.2.16
@angular/material 7.3.2
@ngtools/webpack 10.0.4
@schematics/angular 7.0.7
@schematics/update 0.10.7
rxjs 6.3.3
typescript 3.1.6
webpack 4.43.0
Run Code Online (Sandbox Code Playgroud) 我在将本地项目链接到 git 存储库时遇到问题。
当我创建一个与git存储库同名的新文件夹时,问题就开始了,然后我跑到git clone本地获取源代码。但发生的事情是存储库下载并在我创建的文件夹中创建。因此,为了以正确的路径运行应用程序,我剪切了下载的存储库并将其传递到根目录中,然后删除了主文件夹(链接到主文件夹)。现在我对应用程序进行了一些更改,我想将该文件夹链接到 git 存储库以推送更改。
结果,我有一个项目,我想将此项目链接到现有的 git 存储库。
我有两个组件,Parent Component并且Child component有一个在 中发生的 API Parent component,并且响应值被传递到child component。目前我正在使用,ngOnChanges但我想知道如何使用Setters。
假设ParentComponent我有以下代码:
<ChildComponent [apiResponse]="res" />
Run Code Online (Sandbox Code Playgroud)
在ChildComponent我有这个:
@Input() apiResponse: any;
ngOnChanges(changes: SimpleChanges) {
console.log(this.apiResponse)
}
Run Code Online (Sandbox Code Playgroud)
每次apiResponse更改时,该ngOnChanges函数都会触发并在控制台中打印该值。
如果我想达到结果但使用 if Setters。与其他情况一样,我可能有多个输入,并且我不想ngOnChanges每次输入值更改时都被解雇。
我想使用ngIf更改在迭代中显示的名称,我正在尝试执行以下操作:
*ngIf="detail.name=='dieselG_d'? detail.name='Diesel Green':Diesel Red
Run Code Online (Sandbox Code Playgroud)
并且控制台记录了以下错误:
Uncaught Error: Template parse errors:
Run Code Online (Sandbox Code Playgroud) 我对我应该选择的数据库感到困惑,因为我正在做的应用程序将存储和处理大数据,我认为SQL Server会比MySql更好,任何推荐?
我想构建我的反应项目并设置我的APIs 和方法,以便在单独的文件中进行调用。我来自 Angular 背景,在 Angular 中有处理所有http调用的服务。
因此,假设我有一个包含两个文件的functional component调用Supplier,Supplier.js并且Supplier.css. 我想添加一个新文件并SupplierServices.js在这个文件中调用它我想编写所有调用服务器的方法并简单地将它导入到Supplier.js.
如何实现这一目标?
我有一个有 6 列的表格,其中一列是日期,日期的默认显示格式是2020-04-30T21:30:07.000Z我想将其更改为30-04-2020.
export const columns = [
{ title: `ID`, dataIndex: `invoice_id`},
{ title: `Invoice Number`, dataIndex: `invoice_number` },
{ title: `Amount`, dataIndex: `invoice_amount`},
{ title: `Store Name`, dataIndex: `store_name`},
{ title: `Supplier Name`, dataIndex: `supplier_name`},
{ title: `Creation Date`, dataIndex: `invoice_date`,},
]
<Table bordered columns={columns} dataSource={invoices_list} />
Run Code Online (Sandbox Code Playgroud)
我相信应该有一种方法将日期格式传递给列。我查看了ant表文档但没有找到解决方案。
我想了解这个让我感到困惑的概念。
假设我有以下逻辑:
function test(){
var jsonObj_1 = {};
var jsonObj_2 = {};
jsonObj_2 = jsonObj_1;
jsonObj_2.myKey = 3;
console.log(jsonObj_2) // result => {myKey:3}
console.log(jsonObj_1) // result => {myKey:3}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是为什么它永远不会被分配时jsonObj_1等于 {myKey:3}?!
angular ×4
javascript ×3
angular6 ×1
angular7 ×1
antd ×1
api ×1
bigdata ×1
bitbucket ×1
database ×1
datatable ×1
eventsetter ×1
git ×1
html ×1
if-statement ×1
json ×1
mysql ×1
node-modules ×1
reactjs ×1
repository ×1
service ×1
setter ×1
sql ×1