小编Lak*_*mon的帖子

Angular 2+:使用组件作为另一个组件的输入

如何使用组件作为 Angular 中另一个组件的输入数据?

\n\n

例如:

\n\n

我想要构建表格组件AppTableComponent:

\n\n
<app-table [dataSource]="dataSource" [columns]="columns">\n  <ng-container tableColumnDef="actions">\n    <a routerLink="/model/edit/{{item.id}}" routerLinkActive="active">Edit</a>\n    <a routerLink="/model/delete/{{item.id}}" routerLinkActive="active">Delete</a>\n  </ng-container>\n  <ng-container tableColumnDef="isActive">\n    <div [ngClass]="{cercl:true, \'is-active\':item.is_active}">&nbsp;</div>\n  </ng-container>\n</app-table>\n
Run Code Online (Sandbox Code Playgroud)\n\n

dataSource是数据数组之和,如Model[]orPerson[]Car[]columns是一个字符串数组,如[\'id\', \'isActive\', \'name\', \'actions\']. 它应该包含数据源行属性名称或附加列名称。

\n\n

我知道如何使用ng-content,但它不是相同的情况。不同之处在于我应该在多个地方使用部分内容。也许我应该使用 ng-contet,但我不知道\xe2\x80\x99t 是什么。

\n\n

我确信我的目标是可能的,因为 Angular 材质表的工作原理如下:

\n\n
<mat-table #table [dataSource]="dataSource">\n    <ng-container matColumnDef="position"></ng-container>\n    <ng-container matColumnDef="weight"></ng-container>\n</mat-table>\n
Run Code Online (Sandbox Code Playgroud)\n\n

请不要建议我使用 Angular 材料表组件。我不需要桌子。我只是想学点新东西。

\n\n

我将非常感谢有关该主题的任何信息或文章!

\n

typescript angular-directive angular-components angular

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

PHP评论中的符号"#@ +"

我在ZF1的评论/文档中找到了一些特殊符号"#@ +"和"#@ - ".例:

/**#@+
 * @access protected
 */
Run Code Online (Sandbox Code Playgroud)

(https://github.com/zendframework/zf1/blob/master/library/Zend/Mail.php#L54)

我之前在另一个不同的存储库中看到过.

这些是什么意思?

php phpdoc special-characters docblocks

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

如何在构造函数中创建需要自己的对象?(PHP)

今天我回忆起两年前接受采访的问题.

我想解决它,因为它非常困扰我.

所以,这是我的PHP类:

class A
{
    function __construct(A $aObject)
    {
        $aObject->getValue();
        return;
    }

    function getValue()
    {
        echo 'Success';
    }
}
Run Code Online (Sandbox Code Playgroud)

我怎么能创建这个类的对象?但我们无法改变这门课程.

php oop class

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