小编Jor*_*mus的帖子

AngularJs - SELECT中的ng-model

的jsfiddle

问题:

我的页面中有一个SELECT元素,用一个填充ng-repeat.它还有ng-model一个默认值.

当我改变值时,ng-model适应,这没关系.但是下拉列表在启动时显示一个空槽,它应该具有选择默认值的项目.

<div ng-app ng-controller="myCtrl">
    <select class="form-control" ng-change="unitChanged()" ng-model="data.unit">
         <option ng-repeat="item in units" ng-value="item.id">{{item.label}}</option>
    </select>
</div>
Run Code Online (Sandbox Code Playgroud)

用JS:

function myCtrl ($scope) {
    $scope.units = [
        {'id': 10, 'label': 'test1'},
        {'id': 27, 'label': 'test2'},
        {'id': 39, 'label': 'test3'},
    ]

        $scope.data = {
        'id': 1,
        'unit': 27
        }

};
Run Code Online (Sandbox Code Playgroud)

javascript jquery angularjs angular-ngmodel

55
推荐指数
3
解决办法
13万
查看次数

setFromObject(mesh)有时会返回错误的值

THREE.Box3.setFromObject(*object*)返回错误的值.向您展示的最佳方式是向您展示我的工作方式:

我从顶点创建2个网格.第一个是triangle()功能,另一个是trapezoidForm().

var triangle = function (base, height) {

    return [
        new THREE.Vector2(0,  -height / 2),
        new THREE.Vector2(-base / 2,  height / 2),
        new THREE.Vector2(base / 2,  height / 2)
    ];
}
var trapezoidForm = function (base, upperBase, height) {

    return [

        new THREE.Vector2(-base / 2,  height / 2),
        new THREE.Vector2(-upperBase / 2,  -height / 2),
        new THREE.Vector2(upperBase / 2,  -height / 2),
        new THREE.Vector2(base / 2,  height / 2),
    ];

}
Run Code Online (Sandbox Code Playgroud)

我使用返回的值来创建我的网格:

var material …
Run Code Online (Sandbox Code Playgroud)

javascript bounding-box three.js

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

Sharepoint UploadFile“指定的参数超出了有效值的范围”

我正在尝试将文件从一个库复制到远程事件接收器中的另一个库。

当到达UploadFile-function 时,我收到以下错误:

Specified argument was out of the range of valid values. Parameter name: bytesToCopy

有关该功能的信息可以在此处找到。它具有以下签名:

public static Microsoft.SharePoint.Client.File UploadFile (this Microsoft.SharePoint.Client.Folder folder, string fileName, System.IO.Stream stream, bool overwriteIfExists);
Run Code Online (Sandbox Code Playgroud)

我的代码是:

using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
{
    ClientResult<Stream> data = curItem.File.OpenBinaryStream();
    clientContext.ExecuteQuery();

    if (data != null && data.Value != null)
    {

         data.Value.CopyTo(stream);
         UploadedFile = destinationList.RootFolder.UploadFile(curItem.File.Name.ToString(), stream, true);
    }
}
Run Code Online (Sandbox Code Playgroud)

请注意:curItemdestinationListcurItem.File都在上下文中加载。

编辑,完成错误:

   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
   at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryImplementation(ClientRuntimeContext clientContext, Int32 …
Run Code Online (Sandbox Code Playgroud)

c# sharepoint csom

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

错误地返回一个对象?

我有一个看起来像这样的以下函数:

    function addProperty(object, property) {

}
Run Code Online (Sandbox Code Playgroud)

我必须将property参数的值添加为object参数的键.必须将new属性的值设置为null.之后,我将返回带有新添加属性的对象.预期的输入是这样的:{ x: 5 }, 'y'左边的对象和右边的属性.预期的产出是这样的:{ x: 5, y: null }.

这是我到目前为止:

function addProperty(object, property) {
   object = { object, [property]: null};
  return object;
}

addProperty({x:5}, 'y');
Run Code Online (Sandbox Code Playgroud)

这是我得到的输出:{ object: { x: 5 }, y: null }.我在这做错了什么?我如何摆脱输出开头看起来像对象属性的东西,并留下对象本身和属性??.

javascript ecmascript-6

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

更新列具有最高值的位置

我正在尝试为具有以下结构的表编写一个简单的“撤消”系统:

id    element    position    start_date    end_date
1       1          23        01/01/2015    05/01/2015
2       2          36        01/01/2015    NULL
3       1          17        05/01/2015    NULL
Run Code Online (Sandbox Code Playgroud)

因此,当为现有元素添加新操作时,它会添加具有新位置和当前日期的新行,并将该元素前一行的 end_date 更改为当前日期。

现在,要撤消此操作,我删除了未定义 end_date 的元素行(这是该元素的最新操作),但随后我必须将前一行的 end_date 更改为null.

因此,在伪语言中,所需的查询是:

UPDATE [table] SET end_date = NULL
WHERE element = 1
  AND start_date = 'highest_start_date_to_be_found_of_this_element'
Run Code Online (Sandbox Code Playgroud)

问题:输入什么而不是highest_start_date_to_be_found_of_this_element让它工作?

sql sql-server

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