小编isw*_*wak的帖子

更新arangodb中的内部对象

我有一个存储在arangodb中的对象,它有额外的内部对象,我当前的用例要求我只更新其中一个元素.

存储对象

{
  "status": "Active",
  "physicalCode": "99999",
  "postalCode": "999999",
  "tradingCurrency": "USD",
  "taxRate": "14",
  "priceVatInclusive": "No",
  "type": "eCommerce",
  "name": "John and Sons inc",
  "description": "John and Sons inc",
  "createdDate": "2015-05-25T11:04:14+0200",
  "modifiedDate": "2015-05-25T11:04:14+0200",
  "physicalAddress": "Corner moon and space 9 station",
  "postalAddress": "PO Box 44757553",
  "physicalCountry": "Mars Sector 9",
  "postalCountry": "Mars Sector 9",
  "createdBy": "john.doe",
  "modifiedBy": "john.doe",
  "users": [
    {
      "id": "577458630580",
      "username": "john.doe"
    }
  ],
  "products": [
    {
      "sellingPrice": "95.00",
      "inStock": "10",
      "name": "School Shirt Green",
      "code": "SKITO2939999995",
      "warehouseId": "723468998682"
    },
    { …
Run Code Online (Sandbox Code Playgroud)

arangodb aql

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

使用 AQL /_api/cursor 而不是 /_api/simple/all 进行 Arangodb 分页

Arangodb 有一个用于简单查询的 LIMIT 和 SKIP 函数,如何使用 /api/cursor 实现

FOR product in products
    LIMIT 2
return product
Run Code Online (Sandbox Code Playgroud)

理想情况下是这样的

FOR product in products
    LIMIT 20 SKIP 10
return product
Run Code Online (Sandbox Code Playgroud)

或者它只支持使用/_api/simple/all调用

arangodb aql

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

Angular2 styleUrls不加载外部样式

在angular2应用程序上工作,希望能够为公共内容和管理内容加载不同的样式.然而,似乎Angular忽略从外部源加载的样式

@Component({styleUrls:["http://url_to_external_styles"]})
Run Code Online (Sandbox Code Playgroud)

上面的代码没有按预期工作,是否需要使用完整URL从外部源加载样式的任何其他配置?加载相对于组件的样式100%,但是对从内容服务器加载更感兴趣.

angular

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

Dynamic From FormArray 新添加的控件更改未传播

注意到 angular5 表单的奇怪行为,使用构建器构建一个表单,其中包含捕获附加动态数据所需的表单数组,表单数组值仅在以下情况下更新:

  1. 在创建过程中初始表单控件添加到表单数组this.formBuilder.array(this.getRow())
  2. 当第一个初始控件被触摸时

Angular 版本 5.2.0 实验/示例代码在这里

第 1/2 点附录

更改似乎仅在未动态添加到 FormArray 的组件上注册

表单数组元素包含初始化过程的代码

  ngOnInit(){
    this.form = this.formBuilder.group({
      name:[null],
      description:[null],
      hobbies:this.formBuilder.array([this.getRow()])
    });
  }

  getRow():FormGroup{
    return this.formBuilder.group({
      hobby:[null],
      description:[null]
    });
  }
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

尽管很明显创建了额外的控件,但它们都是空的

然而,一旦触摸第一个元素(注意到从 Fishing 到 Fishing4 的变化,并且控制台输出现在具有剩余动态添加控件的值),所有新的动态字段值都会传播

在此输入图像描述

angular2-forms angular2-formbuilder angular formarray

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

Javascript从两个对象数组生成矩阵

试图将无限数量的对象数组转换为矩阵.

height: [1,3,4,5,6,7]
weight: [23,30,40,50,90,100]
Run Code Online (Sandbox Code Playgroud)

1 23
1 30
1 40
1 50
...
3 23
3 30
3 40
...
Run Code Online (Sandbox Code Playgroud)

基本上将所有可能的组合映射到矩阵中

我尝试使用underscore.js中的一些函数来解决问题

                var firstOption = _.first( productOptionKeys );
                $.each( productOptions[ firstOption ].split(","), function(index, value){
                    var matrixRow = [];
                    var matricableOptionKeys = _.reject( productOptionKeys, function(option){ return (option == firstOption); }  );

                    matrixRow.push( value );

                    $.each( matricableOptionKeys, function( index, value ){
                        var matricableOptions = productOptions[ value ].split(",");
                        var matricIndex = 0;
                        for( i=0 ; i<matricableOptions.length; i++ ){
                            matrixRow.push( matricableOptions[ matricIndex …
Run Code Online (Sandbox Code Playgroud)

javascript arrays

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