如何过滤输入文本中的数组对象 - 角度\n我正在尝试创建一个搜索栏来过滤用户可以搜索我将其命名为“传感器”的位置/描述的位置。
\n\n validateForm: FormGroup;\n rowData: templogRecord[] = [];\n option: any = [];\n\n onLoad() {\n this.rowData = record.default.records;\n\n this.option = [];\n\n this.rowData.forEach(room => {\n this.option.push({\n tooltip: {\n formatter: "{a} <br/>{b} : {c}\xc2\xb0"\n },\n toolbox: {\n show: true,\n feature: {\n mark: { show: false },\n restore: { show: false },\n saveAsImage: { show: false }\n }\n },\n series: [\n {\n name: room.sensor,\n type: \'gauge\',\n center: [\'40%\', \'70%\'],\n splitNumber: 10,\n radius: \'70%\',\n axisLine: {\n lineStyle: {\n color: [[0.2, \'#48b\'], …
Run Code Online (Sandbox Code Playgroud) data = [{
id: "txv3vvBr8KYB",
name: "room 1"
},{
id: "txv3vvBr8KJB",
name: "room 2"
},{
id: "txv3vvBr8K",
name: "room 4"
},{
id: "txv3vvBr8LKP",
name: "room 3"
},{
id: "txv3vvBr8LDS",
name: "room 5"
}]
roomList = [
{
room: {
code: "r001",
id: "txv3vvBr8KYB",
name: "room 1",
status: "FULL"
}
},
{
room: {
code: "r002",
id: "txv3vvBr8KJB",
name: "room 2",
status: "FULL"
}
},
{
room: {
code: "r003",
id: "txv3vvBr8LKP",
name: "room 3",
status: "FULL"
}
}
]
Run Code Online (Sandbox Code Playgroud)
我在这里尝试做的是过滤 …
如何ng build project
在不编辑 angular.json 的情况下修复in angular
这是错误
Your global Angular CLI version (8.3.16) is greater than your local
version (8.1.3). The local Angular CLI version is used.
To disable this warning use "ng config -g cli.warnings.versionMismatch false".
chunk {0} runtime-es2015.52e4031f7f0d4c5547f5.js (runtime) 2.25 kB [entry] [rendered]
chunk {1} main-es2015.4e8665ff7ceef4e442ee.js (main) 4.62 MB [initial] [rendered]
chunk {2} polyfills-es2015.556027bb8b3cb9b5932e.js (polyfills) 173 kB [initial] [rendered]
chunk {3} styles.26e824d23ac01d2a1ba0.css (styles) 695 kB [initial] [rendered]
chunk {4} 4-es2015.823687dfc617d3f0d9c2.js () 3.43 kB [rendered]
chunk {5} …
Run Code Online (Sandbox Code Playgroud) 如何在pinnedBottomRowData
整个底行添加背景
这是代码
列表.component.ts
columnDefs = new Array();
rowData = new Array();
pinnedBottomRowData: any;
ngOnInit() {
this.columnDefs = [
{
'headerName': 'Style/Machine',
'field': 'total',
}
];
for (let i = 1; i < 30; i++) {
this.rowData.push(
{
'total': 'Machine ' + i
}
);
}
this.pinnedBottomRowData = this.createData(1);
}
createData(count: number) {
const result = [];
for (let i = 0; i < count; i++) {
result.push({
total: 'Total Machine'
},
{
total: 'Total',
});
}
return result; …
Run Code Online (Sandbox Code Playgroud) 如何基于比较/合并两个数组assetCode
。
这是代码:
list.component.ts
data = [
{
code: "Machine 1",
assetCode: "PRN",
assetCount: 1,
date: "2019-01-18 00:00:00"
},
{
code: "Machine 1",
assetCode: "PRN",
assetCount: 1,
date: "2019-01-19 00:00:00"
},
{
code: "Machine 2",
assetCode: "PRN 1",
assetCount: 3,
date: "2019-01-20 00:00:00"
},
{
code: "Machine 3",
assetCode: "PRN",
assetCount: 1,
date: "2019-01-21 00:00:00"
},
{
code: "Machine 4",
assetCode: "PRN 1",
assetCount: 3,
date: "2019-01-22 00:00:00"
},
{
code: "Machine 5",
assetCode: "PRN 1",
assetCount: 3,
date: …
Run Code Online (Sandbox Code Playgroud) 我收到错误404,但找不到http:// localhost:4200 / assets / icons / weather / .svg
在我的HTML中
list.component.html
<img src="./assets/icons/weather/{{ weatherClass?.img }}.svg" width="130px" />
Run Code Online (Sandbox Code Playgroud)
天气服务
export class Weather {
constructor(
public locName: string,
public temp: string,
public img: string,
public type:string,
public tempMin:string,
public tempMax:string,
public countryName: string,
public sunrise: string,
public sunset: string) {}
}
Run Code Online (Sandbox Code Playgroud)
list.componen.ts
this.weatherService.currentLocation(this.lat, this.lon).subscribe(data => {
let sunset = format(new Date(data.sys.sunset * 1000), 'hh:mm a');
this.weatherClass = new Weather(
data.name,
data.main.temp,
data.weather[0].icon,
data.weather[0].description,
data.main.temp_max,
data.main.temp_min,
data.sys.country
);
return this.weatherClass;
});
Run Code Online (Sandbox Code Playgroud)