小编pet*_*tur的帖子

将@ fortawesome/fontawesome包含在angular-cli项目中

我正在尝试将font awesome 5包含在运行Angular> 5.0.0的angular-cli项目(1.6.0)中.

我用过(如上所述):

yarn config set @fortawesome:registry https://npm.fontawesome.com/xxxxx-xxxx-xxx-xxx-xxxxxxx
yarn add @fortawesome/fontawesome
yarn add @fortawesome/fontawesome-pro-light
Run Code Online (Sandbox Code Playgroud)

它成功地获得了包.现在我想把包裹包含在我的angular-cli中.在我app.component.ts试图做的事情中(如https://www.npmjs.com/package/@fortawesome/fontawesome所述):

import  fontawesome  from '@fortawesome/fontawesome'
import { faUser } from '@fortawesome/fontawesome-pro-light'
Run Code Online (Sandbox Code Playgroud)

但是打字稿会引发错误:

ERROR in src/app/app.component.ts(2,9): error TS1192: Module '"xxx/node_modules/@fortawesome/fontawesome/index"' has no default export.
Run Code Online (Sandbox Code Playgroud)

使用Font Awesome 4我只将.css文件包含在"styles"数组中.但Font Awesome 5没有包含所有css的css文件.它只是一堆.js文件.

如何在Angular CLI项目中正确包含Font Awesome 5?(我希望能够<i class="fal fal-user"></i>在我的标记中使用)

font-awesome angular-cli font-awesome-5 angular angular-fontawesome

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

OpenLayers没有缩小?

我试图找到一个OpenLayers3.js没有微调的文件,这是一个痛苦调试的东西,它被缩小,任何人都可以帮我找到它?

我现在使用这个地址:http://openlayers.org/en/v3.0.0/build/ol.js

顺便说一句,它在顶部是一个特殊的东西.请访问网站:http://ol3.js.org/?让我开怀大笑.

救命?

openlayers-3

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

在ngSelect中设置默认值

我有一些选项,里面有一些选项.

<select data-ng-model="type" data-ng-change="option(type)">
   <option data-ng-repeat="type in languages" value="{{type.i18n}}">
        {{type.language}}
    </option>
</select>
Run Code Online (Sandbox Code Playgroud)

还有一个控制器

angular.module('navigation', [])
.controller('NavCtrl',['$scope','$translate', function($scope,$translate){

    $scope.option = function(type){
        console.log(type) //this display the i18n value of languages
        $translate.use(type);
    }

    $scope.languages = [
        { language: "English", i18n: "en_EN"},
        { language: "Swedish", i18n : "se_SE" }
    ];
}])
Run Code Online (Sandbox Code Playgroud)

我希望ngSelect有一个默认选项,在我的情况下:"英语".我试着把它设置为:

$scope.type = $scope.languages[0].language; // English
$scope.type = $scope.languages[0]; //The whole darn json object.
Run Code Online (Sandbox Code Playgroud)

请帮忙?

angularjs angularjs-directive angularjs-scope

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

NET::ERR_CERT_AUTHORITY_INVALID 在 Chrome 中不能隐身,Firefox 在本地具有 nginx 上的有效证书

几周前,我们对我们的 cookie 实施了 SameSite cookie 策略。如果我想在本地开发,我需要一个证书来获取 cookie。

我们正在运行一个 Node express 服务器,它被反向代理到我们添加证书的 nginx 配置。

# Server configuration
#
server {
    listen 443;
    server_name test-local.ad.ourdomain.com;
    ssl_certificate           /home/myname/.certs/ourcert.crt;
    ssl_certificate_key       /home/myname/.certs/ourkey.rsa;
    ssl on;
    ssl_session_cache  builtin:1000  shared:SSL:10m;
    ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
    ssl_prefer_server_ciphers on;
    location / {
        proxy_set_header        Host $host;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto $scheme;
        proxy_pass          http://localhost:9090;
        proxy_read_timeout  90;
        proxy_redirect      http://localhost:9090 https://test-local.ad.ourdomain.com;
    }
}
Run Code Online (Sandbox Code Playgroud)

现在到了奇怪的部分。我们今天更新到 Chrome 80,突然间我遇到了 HSTS 问题。即使我想访问网站,我也无法访问(没有选择的可能性)。我试图在 chrome://internals/#hsts 中清除它,并且奏效了。但是,我仍然得到,NET::ERR_CERT_AUTHORITY_INVALID但我现在可以选择替代。

从 Chrome 隐身模式访问它就像一个魅力,没有问题。与 Firefox 相同,那里也没有问题。它说证书有效,绿色且漂亮。也在这里检查:https : …

ssl google-chrome nginx

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

从OpenLayers中的群集中获取功能?

我有一个阵列,有很多不同的位置,有名字和图片,当然还有经度和纬度.如果我将它们直接放在地图上,就会变得杂乱无章.所以我尝试使用集群.

从创建功能开始:

 for(var i = 0; i < points.length; i++){
     features[i] = new ol.Feature({
     population: 4000,
     name : points[i].name,
     geometry: new ol.geom.Point(
     ol.proj.transform([
     points[i].long,
     points[i].lat],
     'EPSG:4326', oProjection))
     });
 }
Run Code Online (Sandbox Code Playgroud)

然后,我使用具有以下功能的向量填充集群:

var vSource = new ol.source.Vector({ features: features});

var vFeatures = vSource.getFeatures();

var clusterSource = new ol.source.Cluster({
                   distance: 20,
                   source: vSource});
Run Code Online (Sandbox Code Playgroud)

然后我用一些图标设置簇的样式

var clusters = new ol.layer.Vector({
          source: clusterSource,
          style : new ol.style.Style({
                image: new ol.style.Icon(({
                src: 'image/image.png'})),
          text: new ol.style.Text({
                font: '18px Helvetica, Arial Bold, sans-serif', …
Run Code Online (Sandbox Code Playgroud)

javascript openlayers-3

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

使用 Mapnik、PostGIS 等在 OpenStreetMap 服务器上切换样式

我使用本指南创建了一个 OpenStreetMap 服务器:切换到 osm它非常好并且工作起来就像一个魅力。我还能够使用TileMillosm-brigth添加新主题

但是,我现在希望能够在两个主题osm-brightosm-night之间切换。这是一个 apache 问题还是有办法修改 mapnik 以便能够从例如 openlayers 获取参数以在这两个主题之间切换?

感谢您的任何建议。

openstreetmap mapnik tilemill

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

我如何在打字稿中输入这个对象?

我的对象看起来像这样:

 const searchOptions: any = {
      fullText: 'hifi',
      'brand.id': [1,2,3,4],
      'category.id': [1,2,3,4],
      'country.id': [1,2,3,4],
      'property.id': [1,2,3,4],
    }
Run Code Online (Sandbox Code Playgroud)

这非常方便,因为 API 接受相同的查询参数。

我如何在 TypeScript 中输入这个对象?

typescript

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

从id获取父对象,该对象与NodeJS中的mongoose对象子数组匹配

我在NodeJS中使用mongoose,我有一个来自子数组的id.我的模型定义如下:

var thingSchema = new schema({
    thingId: String,
    smallerThings : [smallerThingsSchema]
});

var smallerThingsSchema = new schema({
    smallerThingId: String,
    name : String,
    anotherName : String
});
Run Code Online (Sandbox Code Playgroud)

我有smallerThingId,但我想得到thingId.

现在我有一个看起来像这样的for循环(我认为非常无效).潜在地,可能有100,000件事情.

//Find all things
thingModel.find({}, null, function (error, things) {
    if (error) {
        callback(error);
    }
    else {
        //Go through all things  
        for(var i = 0; i < things.length; i++){
            //check if a thing with the array of smaller things matches the id
            for(var j = 0; j<things[i].smallerThings.length; j++){
                if(things[i].smallerThings[j].id …
Run Code Online (Sandbox Code Playgroud)

javascript mongoose mongodb node.js

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