-1

我正在使用 Angular 2 开发我的第一个应用程序,并且我已经为 Google Chrome 安装了 Augury 插件,以帮助我调试代码。

这是组件树和图表:

在此处输入图像描述

在此处输入图像描述

这是我的自定义组件 (DocumentsList) 的 HTML 模板:

<div class="container-fluid" style="margin-top: 10px">
    <div class="table-row header">
        <div class="column index">#</div>
        <div class="wrapper attributes">
            <div class="wrapper title-comment-module-reporter">
                <div class="wrapper title-comment">
                    <div class="column title">Title</div>
                    <div class="column comment">Comment</div>
                </div>
                <div class="wrapper module-reporter">
                    <div class="column module">Module</div>
                    <div class="column reporter">Reporter</div>
                </div>
            </div>
            <div class="wrapper status-owner-severity">
                <div class="wrapper status-owner">
                    <div class="column status">Status</div>
                    <div class="column owner">Owner</div>
                </div>
                <div class="column severity">Severity</div>
            </div>
        </div>
        <div class="wrapper icons">
            <div title="Watch" class="column watch">
                <span class="glyphicon glyphicon-eye-open"></span>
            </div>
            <div title="Add comment" class="column add-comment">
                <span class="glyphicon glyphicon-comment"></span>
            </div>
        </div>
        <div class="wrapper dates">
            <div class="column date">Created</div>
            <div class="column date">Updated</div>
            <div class="column date">Due</div>
        </div>
    </div>

    <div *ngFor="let document of docs" class="table-row">
        <div class="column index">{{document.id}}</div>
        <div class="wrapper attributes">
            <div class="wrapper title-comment-module-reporter">
                <div class="wrapper title-comment">
                    <div class="column title">{{document.title}}</div>
                    <div class="column comment">{{document.comment}}</div>
                </div>
                <div class="wrapper module-reporter">
                    <div class="column module">{{document.module}}</div>
                    <div class="column reporter">{{document.reporter}}</div>
                </div>
            </div>
            <div class="wrapper status-owner-severity">
                <div class="wrapper status-owner">
                    <div class="column status"><span class="label" [ngClass]="{'Open': 'label-primary', 'In Progress': 'label-success'}[document.status]">{{document.status}}</span></div>
                    <div class="column owner">{{document.owner}}</div>
                </div>
                <div class="column severity high">{document.severity}}</div>
            </div>
        </div>
        <div class="wrapper icons">
            <div class="column watch"><span class="glyphicon glyphicon-eye-open" [class.active]="document.watched"></span></div>
            <div class="column add-comment"><span class="glyphicon glyphicon-comment" [class.active]="document.commented"></span></div>
        </div>
        <div class="wrapper dates">
            <div class="column date">{{document.created}}</div>
            <div class="column date">{{document.updated}}</div>
            <div class="column date">{{document.due}}</div>
        </div>
    </div>
</div>

由于span图中的div是有*ngFor指令的 a 的子级,所以它不应该在图中显示为 的父级span吗?

我认为图表应该看起来像这样(使用 Paint 创建的图像)

在此处输入图像描述

在此处输入图像描述

4

1 回答 1

2

简短的回答,是的。这说得通。

于 2016-07-06T13:26:52.503 回答