小编J.B*_*Mai的帖子

在Angular 1.5中,如何将属性组件绑定为布尔值?

我想知道在Angular 1.5中,当你使用组件时,有一种简单的方法来绑定一个属性,它是一个布尔值而不用@转换为字符串.

例如,我有两个组件"app-menu"和"app-menuitem"没有转换."app-menu"只有一个属性,是要创建"app-menuitem"的项目列表.

<app-menu items="menuitems">
Run Code Online (Sandbox Code Playgroud)

在作为json的menuitems中,你有一个名为"isactive"的menuitem属性,它是一个布尔值.

$scope.menuitems = [{ label : 'menuitem 1', isactive : true},{ label : 'menuitem 1', isactive : false}]
Run Code Online (Sandbox Code Playgroud)

在menuitem组件中:

angular.module('app')
    .component('appMenuitem', {
      transclude: false,
      controller: menuitemController,
      bindings: {
        label: '@',  
        isactive: '@' //<--- The problem is here because the boolean is converted as string
      },
      templateUrl: 'angular/components/simple/menuitem/menuitem.html'
    });
Run Code Online (Sandbox Code Playgroud)

我不知道最好的方法是确保最终是一个真正的布尔值,而不是一个字符串,这让我有些错误.有人有想法吗?

binding components angularjs angularjs-directive angularjs-components

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

有没有办法在Angular2组件中的ng-content中使用css?

我试图在组件中包含css for children元素ng-content.它似乎尚未在Angular 2中实现,或者除了将css放在一般样式表中之外,有人可能有解决方案?

app.component.ts

<comp-parent>
  <comp-child></comp-child>
</comp-parent>
Run Code Online (Sandbox Code Playgroud)

compParent.component.html

<div class="wrapper">
  <ng-content></ng-content>
</div>
Run Code Online (Sandbox Code Playgroud)

compParent.component.css

.wrapper > comp-child {
   margin-right: 5px; <-- Not applied !!!
}
Run Code Online (Sandbox Code Playgroud)

css styles angular2-ngcontent angular

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

如何在localhost上使用recaptcha v2?

使用谷歌recaptcha版本2为我的wordpress,我在我的谷歌帐户端添加了"localhost"域(我也试过"127.0.0.1"),我得到了密钥,但在我的客户端我得到了这个错误:

错误:站点密钥的域无效

  • 所有者电子邮件是正确的Gmail电子邮件
  • 站点密钥是正确的

有没有办法在Localhost上测试recaptcha(版本2)(使用虚拟主机)?

localhost recaptcha

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

如何修复 AngularJS 1.6 中的 [$sce:itype] 错误?

我正在使用 AngularJS 1.6.4,我收到有关$sce的错误:

错误:[$sce:itype] http://errors.angularjs.org/1.6.4/ $sce/itype?p0=html 跟踪 de la 桩:L/<@ https://ajax.googleapis.com/ajax /libs/angularjs/1.6.4/angular.min.js:6:425 trustAs@ https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js:155:46 [ ...]

主控制器

(function(angular) {
    'use strict';
    angular.module('fooModule')
    .controller('MainCtrl', ['$scope', '$q', '$http', '$sce', function ($scope, $q, $http, $sce){
           ...
           $q.all([
            ...
        ]).then(function(responses) {
             $scope.send = function(){                                                           
                var data = {
                       ...
                    };

                    $http({
                        url: 'file.php',
                        method: "POST",
                        data: $.param(data),
                        headers: {'Content-Type': 'application/x-www-form-urlencoded'}
                    }).then(function successCallback(response) {
                        $scope.dataResponse = $sce.trustAsHtml(response);
                    }, function errorCallback(response) {
                        console.dir(response);
                    });
                }

            };
        });
           ...
     }]);
})(window.angular);
Run Code Online (Sandbox Code Playgroud)

我不明白这个错误是什么意思。有人可以解释我吗?我该如何解决它?

javascript http angularjs

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

使用 gulp 复制 .​​htaccess(一个点文件)失败

在 gulp 任务中,我尝试复制构建文件夹中的文件。

gulp.task( addon, function() {
    var a_addon_function = addon.split("_") ;
    var addon_dirname = a_addon_function[1];
    var dest_path = ( options.env === "tests" || ( options.env === "dist" && options.type === "premium" ) ) ? build_path + addon_dirname + "/" + addon_dirname : build_path + addon_dirname;
    return gulp.src( [ "./plugins/addons/" + addon_dirname + "/**/*", "./plugins/_common/**/*", "./plugins/addons/_common/**/*" ] )
       .pipe( gulp.dest( dest_path ) 
    );
});
Run Code Online (Sandbox Code Playgroud)

该文件.htaccess永远不会被复制。为什么 ?如何解决这个问题?

.htaccess file-copying gulp

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

如何为 Plesk 系统用户获取使用 php 命令行的权限

我\xc2\xb4m 是linux/server/plesk 的真正初学者。我不得不租一个虚拟服务器Ubunthu来制作测试环境。

\n\n

公司(主机)自动安装了 Plesk 软件来帮助我。\n我想使用除通过 ssh 之外的用户来使用键或root运行一些命令行。phpcomposer

\n\n

这适用于用户root,但是当我通过 ssh 通过我的 plesk 系统用户连接时,发现了任何命令:

\n\n
\n

bash:npm:找不到命令

\n\n

bash: php: 未找到命令

\n
\n\n

ETC...

\n\n

根据 Plesk 的说法,该用户是系统用户。

\n\n

在 plesk 面板内,\xc2\xb4s 写着:

\n\n
\n

您可以在此处指定操作系统用户,以通过 FTP 或文件管理器管理网络空间内的文件和文件夹。如果授予了相应的权限,则系统用户还可用于通过 SSH(在 Linux 上)或 RDP(在 Windows 上)访问 Plesk。

\n
\n\n

如果我可以通过 SSH 访问 Plesk,这意味着我可以运行命令行还是仅使用 FTP 和文件管理器?

\n\n

我怎样才能像root用户一样获得 plesk 用户的所有命令行?

\n\n

我的目标是让用户只能在 plesk 范围(httpdocs文件夹)内运行命令行并在 plesk 面板中执行一些操作,特别是在文件管理器中。

\n\n

我按照本教程php进行操作,但是php …

linux plesk plesk-onyx

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

错误 工作树不干净。首先提交或隐藏更改

我收到 npm 超时错误,所以我遵循了这个答案。\n当我运行时pnpm publish --otp=111111,我收到此错误:

\n\n
\n

\xe2\x80\x89ERROR\xe2\x80\x89 不干净的工作树。首先提交或隐藏更改。

\n
\n\n

这个错误是什么意思?我怎样才能解决这个问题 ?

\n

runtime-error pnpm

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

XSD 1.1 - 发现以元素“xs:alternative”开头的无效内容

在我的 XSD 中,我尝试使用alternative标签。由于某些原因,我在 IDE (PHPStorm) 中遇到此错误:

无效内容以元素“xs:alternative”开头...

XSD

<xs:complexType name="tableType">
    <xs:sequence>
        <xs:element type="columnType" name="column" maxOccurs="unbounded" minOccurs="0"/>
        <xs:element type="keyType" name="key" maxOccurs="unbounded" minOccurs="0">
            <xs:alternative test="@type='index'" type="keyIndexType"/>
            <xs:alternative test="@type='unique'" type="KeyUniqueType"/>
        </xs:element>
    </xs:sequence>
    <xs:attribute type="xs:string" name="name" use="required"/>
</xs:complexType>
Run Code Online (Sandbox Code Playgroud)

我发现我不应该添加更多东西来使用 1.1 xsd 版本,但是我需要一些东西来支持alternative标签吗?

xml xsd xsd-validation phpstorm xsd-1.1

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