小编Roc*_*cky的帖子

为什么我们称 RxJS Subject 为 Multicast 而 Observable 为 Unicast?

我从某个时候开始使用 RxJS,我似乎无法理解为什么我们调用RxJS SubjectasMulticastObservableas Unicast

我知道它Subject能够使用next()和像普通的 Observable 一样发送数据,我们也可以订阅它们。

我从 RxJS 官方网站上找到了这个

A Subject is like an Observable, but can multicast to many Observers. 
Run Code Online (Sandbox Code Playgroud)

这是否意味着一个普通的 Observable 不能有多个观察者?

observable rxjs angular

6
推荐指数
1
解决办法
1367
查看次数

找不到模块:错误:无法解析“fs”角度

我在Angular应用程序中实现Mapbox并且正在做如下

将 css 添加到 angular-cli.json

"../node_modules/@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css"

成分

import { Component } from '@angular/core';
import * as mapboxgl from 'mapbox-gl';
import * as MapboxDraw from '@mapbox/mapbox-gl-draw';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})

export class AppComponent {
  static t;
  ngOnInit() {
    mapboxgl.accessToken = 'Token';
    AppComponent.t.map= new mapboxgl.Map({
      container: 'map',
      style: 'mapbox://styles/mapbox/light-v9',
      zoom: 5,
      center: [-78.880453, 42.897852]
    });

     const draw = new MapboxDraw({
        displayControlsDefault: false,
        controls: {
            polygon: true,
            trash: true
        }
    });
    AppComponent.t.map.addControl(draw);
  }
}
Run Code Online (Sandbox Code Playgroud)

它的显示 …

mapbox package.json mapbox-gl angular mapbox-gl-draw

5
推荐指数
1
解决办法
5096
查看次数

如何在角度模板驱动的方法中验证开始和结束日期?

我的表单中有 2 个日期输入,如下所示:

<label class="control-label">Start Date</label>
    <input type="date" name="startDate" placeholder="Start Date" class="form-control" ngModel required #startDate="ngModel">
    <span *ngIf="!startDate.valid && startDate.touched" class="error-msg">
     <span *ngIf="startDate.errors.required">Start Date is required</span>
     </span>
     <br/>
 <label class="control-label">End Date</label>
 <input type="date" name="endDate" placeholder="End Date" class="form-control" ngModel required #endDate="ngModel" >
    <span *ngIf="!endDate.valid && endDate.touched" class="error-msg">
    <span *ngIf="endDate.errors.required">End Date is required</span>
    </span>
Run Code Online (Sandbox Code Playgroud)

而且我想允许用户仅从开始日期中选择日期。我尝试使用该min属性但不起作用

date angular-validation angular

1
推荐指数
1
解决办法
3930
查看次数

如何遍历行并在节点 js 中的 excel 中打印对象值?

我有一个对象数组,如下所示:

[
    {   "FirstName": "John", 
        "LastName": "Parker", 
        "Age": "23", 
        "Cat": "23g",
        "SOP": "Active"
    },
    {   "FirstName": "Rose", 
        "LastName": "Jackson", 
        "Age": "44", 
        "Cat": "44g",
        "SOP": "InActive"
    }
]
Run Code Online (Sandbox Code Playgroud)

我正在使用excel4node创建对象的数据并将其写入 excel

async generateExclReport(req, res) {
        try {

            var wb = new xl.Workbook();

            // Add Worksheets to the workbook
            var ws = wb.addWorksheet('Report');

            ws.cell(1, 1).string('FirstName');
            ws.cell(1, 2).string('LastName');
            ws.cell(1, 3).string('Age');
            ws.cell(1, 4).string('Cat');
            ws.cell(1, 5).string('SOP');


            var fileName = "Report" + Date.now().toString() + '.xlsx';

            res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
            res.setHeader("Content-Disposition", "attachment; filename=" + fileName);
            wb.write(fileName, res);
        } …
Run Code Online (Sandbox Code Playgroud)

excel node.js express excel4node

1
推荐指数
1
解决办法
2593
查看次数

如何在angular4中将对象数组导出到excel?

我有一个对象数组,如下所示

    [
        {   "FirstName": "John", 
            "LastName": "Parker", 
            "Age": "23", 
            "Cat": "23g",
            "SOP": "Active"
        },
        {   "FirstName": "Rose", 
            "LastName": "Jackson", 
            "Age": "44", 
            "Cat": "44g",
            "SOP": "InActive"
        }
    ]
Run Code Online (Sandbox Code Playgroud)

我如何将这些数据与logo公司的数据一起导出到 excel 并下载相同的数据。

任何合适的插件来编写objects datalogo image表现出色?

angular

0
推荐指数
1
解决办法
3593
查看次数

如何根据mapbox中的值填充区域的颜色?

我正在使用基于外部文件绘制邮政编码轮廓的mapboxgeojson如下所示:

import { Component, OnInit } from '@angular/core';
import * as mapboxgl from 'mapbox-gl';

@Component({
  selector: 'app-mapbox',
  templateUrl: './mapbox.component.html',
  styleUrls: ['./mapbox.component.css']
})
export class MapboxComponent implements OnInit {

  ngOnInit() {
    mapboxgl.accessToken = 'api-key';
    let map = new mapboxgl.Map({
      container: 'map',
      style: 'styles',
      zoom: 5,
      center: [-80.118, 25.897]
    });

    map.addControl(new mapboxgl.NavigationControl());

    map.on('load', function () {
      map.addSource("route", {
        "type": "geojson",
        "data": "./assets/shapeGeoJson.json"
      });

      map.addLayer({
        "id": "route",
        "type": "line",
        "source": "route",
        "paint": {
          'line-color': "gray"
        }
      });
    });
  } …
Run Code Online (Sandbox Code Playgroud)

mapbox mapbox-gl-js angular

0
推荐指数
1
解决办法
2995
查看次数