小编Jon*_*nas的帖子

AJAX上传angular.js 1.3.0中的multipart/form-data的'意外令牌'

纹理上传的以下代码在angularjs 1.2.26中工作,但在我将Web应用程序升级到1.3.0时停止工作.

HTML代码

<input file-model="file" name="file" type="file">
Run Code Online (Sandbox Code Playgroud)

fileModel指令

app.directive('fileModel', [ '$parse', function($parse) {
    return {
        restrict : 'A',
        link : function(scope, element, attrs) {
            var model = $parse(attrs.fileModel);
            var modelSetter = model.assign;

            element.bind('change', function() {
                scope.$apply(function() {
                    modelSetter(scope, element[0].files[0]);
                });
            });

            scope.$on("reset", function() {
                element.val(null);
            });

        }
    };
} ]);
Run Code Online (Sandbox Code Playgroud)

上传功能 - 在1.2.26中选择"multipart/form-data",因为Content-Type不起作用.但是使用"undefined"作为Content-Type angular会做一些使它工作的魔法.

var upload = function(textureUploadUrl) {
        var formData = new FormData();
        formData.append('name', $scope.name);
        formData.append('file', $scope.file);

        $http.post(textureUploadUrl, formData, {
            transformRequest : angular.identity,
            headers : {
                'Content-Type' : undefined …
Run Code Online (Sandbox Code Playgroud)

file-upload angularjs

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

Gitlab CI - 无法注册运行器

我已经从源代码设置了 gitlab 安装,使用 LetsEncrypt 保护它并将其部署在https://gitlab.mydomain.com. 我可以访问该网站并创建存储库等,但我找不到注册 gitlab ci runner 进行安装的方法。

Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/ci):
https://gitlab.mydomain.com/ci
Please enter the gitlab-ci token for this runner:
xxxxxxxx-xxxxxxxx
Please enter the gitlab-ci description for this runner:
[server]: test
Please enter the gitlab-ci tags for this runner (comma separated):
test
ERROR: Registering runner... failed     runner=xxxxxxx 
status=couldn't execute POST against https://gitlab.mydomain.com/ci/api/v1/runners/register.json:
Post https://gitlab.mydomain.com/ci/api/v1/runners/register.json: 
read tcp [ipv6address]:33518->[ipv6address]:443: read: connection reset by peer
PANIC: Failed to register this runner. Perhaps you are …
Run Code Online (Sandbox Code Playgroud)

continuous-integration gitlab gitlab-ci gitlab-ci-runner gitlab-8

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

展示隐形父母的孩子

在我的场景中,我有一个对象图,我将子对象添加到父对象。但是,当我设置parent.visible = falsethree.js 时行为正确并且在层次结构中没有显示任何元素。

但是对于我的项目,我想要不同的行为。我希望子对象出现,当它们的可见性是true,即使父对象被隐藏。

实现这一目标的最佳方法是什么?我想过给父对象分配一个透明材质,但听说这会在渲染场景时出现问题,应该省略。

javascript visibility three.js

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