我有横切和购买集合,这是现在我想要将横断面和购买细节转换成单个集合.基于transectionid我们需要结合文件
下面是我的横断面集合数据
{
"transectionid": "1",
"transectionamount": "2000",
"transectiondate": "2016-07-12 19:22:28",
},
{
"transectionid": "2",
"transectionamount": "1000",
"transectiondate": "2016-07-12 20:17:11",
}
Run Code Online (Sandbox Code Playgroud)
下面是我的购买集合数据
{
"purchaseid": "1",
"transectionid": "1",
"itemprice": "1200",
"itemcode": "edcvb",
"itemquantity": "1",
},
{
"purchaseid": "2",
"transectionid": "1",
"itemprice": "800",
"itemcode": "dfgh",
"itemquantity": "2",
},
{
"purchaseid": "3",
"transectionid": "2",
"itemprice": "1000",
"itemcode": "zxcvb",
"itemquantity": "1",
}
Run Code Online (Sandbox Code Playgroud)
我的期望结果:这是订单集合应该如何存储{
"transectionid" : "1",
"transectionamount": "2000",
"transectiondate": "2016-07-12 19:22:28",
"items" : [
{
"purchaseid": "1",
"itemprice":"1200",
"itemcode": "edcvb",
"itemquantity": "1",
},
{
"purchaseid": …Run Code Online (Sandbox Code Playgroud) var logs = [{
mobilenumber: '1',
ref: 3,
points: 1000,
ctype: 'mycredit',
entry: 'sdfsdf',
entry: 0
}, {
mobilenumber: '1',
ref: 6,
points: 2000,
ctype: 'mycredit',
entry: 'sdfsdf',
entry: 0
}, {
mobilenumber: '2',
ref: 7,
points: 2600,
ctype: 'mycredit',
entry: 'sdfsdf',
entry: 0
}, {
mobilenumber: '2',
ref: 15,
points: -1500,
ctype: 'mycredit',
entry: 'sdfsdf',
entry: 0
}, {
mobilenumber: '10',
ref: 15,
points: 800,
ctype: 'mycredit',
entry: 'sdfsdf',
entry: 0
}, {
mobilenumber: '11',
ref: 15,
points: 110, …Run Code Online (Sandbox Code Playgroud)以下是我的请求正文,它是从客户端发送的
var credentials = {
"ConsumerData": {
"ConsumerStoreId": "a",
"ConsumerUserId": "a"
},
"CustomerData": {
"CustomerId": "2345678890"
},
"ErnD": {
"UID": "3",
"TxnDt": "1"
},
"PurD": [{
"ItemCode": "3456tghw3",
"ItemEANCode": "223222122"
},
{
"ItemCode": "8jghw3865",
"ItemEANCode": "3334443222"
}
]
}
Run Code Online (Sandbox Code Playgroud)
测试我发送var credentials = {}空凭据
在服务器端控制器(node,express)中,我想检查req.body是否为空
if(!req.body)
{
console.log('Object missing');
}
if(!req.body.ConsumerData.ConsumerStoreId)
{
console.log('ConsumerStoreId missing');
}
if(!req.body.CustomerData.CustomerId)
{
console.log('CustomerId missing');
}
if(!req.body.ErnD.UID)
{
console.log('UID missing');
}
console.log('outside');
Run Code Online (Sandbox Code Playgroud)
我正在检查所有东西,但仅在外面打印它
我使用材料2创建了Snackbar(下面我添加了演示).当我点击该按钮时,我在主页面中有一个按钮,它在页面底部显示消息(小吃栏).我想将此(小吃栏消息)更改为页面的右上角.我怎样才能做到这一点 ??需要帮忙
HTML
<button mat-button (click)="openSnackBar()" aria-label="Show an example snack-bar">
Pizza party
</button>
Run Code Online (Sandbox Code Playgroud)
component.ts
export class SnackBarComponentExample {
constructor(public snackBar: MatSnackBar) {}
openSnackBar(message="DOne", action = '') {
this.snackBar.open(message, action, {
duration: 5000,
});
}
}
Run Code Online (Sandbox Code Playgroud) $http.get('***').success(function(data, status,response)
{
$scope.items=data;
var getdata=JSON.stringify(data.D_Services);
console.log(getdata);
});
im getting in console
D_Services: "Wash,Tyres,Spares,Accessories";
Run Code Online (Sandbox Code Playgroud)
请任何人帮助我
<div ng-controller="Test1Controller" data-ng-init="loadservice()">
<div ng-repeat="item in items">
<input type="checkbox" ng-model="item.SELECTED" ng-true-value="'Y'" ng-false-value="'N'"/> {{item.D_Services}}
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我需要这样的答案,请任何人帮助我

现在我得到了
login.component.ts
import { Component, OnInit,ViewChild , Inject} from '@angular/core';
import { Login } from './login';
import {MatPaginator, MatSort, MatTableDataSource, MatDialog,MatDialogRef, MAT_DIALOG_DATA} from '@angular/material';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
export class LoginComponent {
animal: string;
name: string;
constructor(public dialog: MatDialog) {}
openDialog(): void {
let dialogRef = this.dialog.open(DialogOverviewExampleDialog, {
width: '250px',
data: { name: this.name, animal: this.animal }
});
dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed');
this.animal = result;
});
}
}
@Component({
selector: 'app-login',
templateUrl: 'dialog-overview-example-dialog.html',
}) …Run Code Online (Sandbox Code Playgroud) 我要使图标和搜索字段在同一行。
<div class="example-header">
<mat-form-field>
<mat-icon>search</mat-icon>
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter">
</mat-form-field>
</div>
Run Code Online (Sandbox Code Playgroud)
上面我添加了我的HTML代码..
我写了很多css,但是我无法获得帮助。
下面的数据存储在我的收藏中
[
{ "_id" : ObjectId("53d9feff55d6b4dd1171dd9e"),"name":"John", "rank":1, "year":1998 ,"class":"a" ,"total":"1128" },
{ "_id" : ObjectId("feff553d95d6b4dd19e171dd"),"name":"Sherif", "rank":1, "year":1999 ,"class":"b" ,"total":"1163"},
{ "_id" : ObjectId("9fef53dd6b4dd1171f55dd9e"),"name":"shravan", "rank":1, "year":2000 ,"class":"b" ,"total":"1113"},
{ "_id" : ObjectId("117153d9fef6b4dddd9ef55d"),"name":"aneesh", "rank":1, "year":2001 ,"class":"d" ,"total":"1145"},
{ "_id" : ObjectId("dd9e53feff55d6b4dd1171d9"),"name":"abdul", "rank":1, "year":1997 ,"class":"a" ,"total":"1100"},
]
Run Code Online (Sandbox Code Playgroud)
我写了api for find,[{ "name":"John", "rank":1, "year":1998 },{ "name":"Sherif", "rank":1, "year":1999 }]这是我从req.body得到的数据,我在这里作为查询提到
router.post('/users',function(req,res){
var query =[{ "name":"John", "rank":1, "year":1998 },{ "name":"Sherif", "rank":1, "year":1999 }]
User.find(query, function(err, result) {
if (err) throw err;
console.log(result);
res.json(result)
}); …Run Code Online (Sandbox Code Playgroud) 我有下面的对象数组,我想检查该数组中是否存在两个不同的用户。如果存在,我必须运行一些逻辑
let result = [{"name": "ABC"},{"name": "CDE"},{"name": "FGH"},{"name": "XYZ"}];
var newArr = [];
var hasMatch = result.filter(function(val) {
if (val.name == "FGH"){
newArr.push(val)
} else if (val.name == "ABC") {
newArr.push(val)
}
});
console.log(newArr)
if (newArr.length == 2) {
//do logic
}Run Code Online (Sandbox Code Playgroud)
它按预期工作,但我正在为此寻找不同的方法。有人可以建议吗?
<script>
var data={
Data: {
name: 'aaaa',
number: '0003'
},
values: {
val: '-20.00',
rate: '22047'
},
user: [ '6|1|5', '10|1|15' ]
};
console.log(data);
console.log(data.user.length);
for(var i=0;i<data.user.length;i++) {
console.log(data.user[i]);
}
</script>
Run Code Online (Sandbox Code Playgroud)
上面是我的代码我想放置循环并得到这样的值
这是我的数据 user: [ '6|1|5', '10|1|15' ]
但我想这样:
排名 - 5
userid - 10
我怎么能这样帮助我?