首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Angular2模板分析误差EOF

Angular2模板分析误差EOF
EN

Stack Overflow用户
提问于 2016-04-01 21:19:57
回答 2查看 930关注 0票数 0

在Angular2 (beta 13)中,我试图显示从数据库中检索到的数据项列表。这部分工作正常。

但是,当我试图在html表中显示这些项(应用程序名称)时,它不起作用。奇怪的是,当它在列表中显示时,它确实工作。

错误消息

代码语言:javascript
复制
EXCEPTION: Template parse errors:
Unexpected character "EOF" ("
        </table>
    </div>
</div[ERROR ->]"): ApplicationsComponent@13:5

applications.html (引起以上错误)

代码语言:javascript
复制
<div class="route-container route-container-margin-0 route-container-width-standard">
    <div class="route-container-padding-standard">
        <p>hello world</p>
        <table>
            <tbody>
                <tr *ngFor="#app of applications">
                    <td >
                        {{app.name}}
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>

applications.html (无错误工作)

代码语言:javascript
复制
<div class="route-container route-container-margin-0 route-container-width-standard">
    <div class="route-container-padding-standard">
        <p>hello world</p>
        <ul>
            <li *ngFor="#app of applications">
                {{app.name}}
            </li>
        </ul>
    </div>
</div>

boot.ts

代码语言:javascript
复制
///<reference path="./../node_modules/angular2/typings/browser.d.ts"/>
import {bootstrap}      from 'angular2/platform/browser';
import {ROUTER_PROVIDERS} from 'angular2/router';

import 'rxjs/Rx'; // kitchen sink

import {AppComponent} from './app.component';
import {HTTP_PROVIDERS}    from 'angular2/http';


// Bootstrap the application and reference the required directives
bootstrap(AppComponent, [ROUTER_PROVIDERS, HTTP_PROVIDERS]);

谢谢你丹。

更新

这是我试图显示的数据(首选为app):

代码语言:javascript
复制
[{"applicationID":1,"name":"Applications","description":"Web applications","applicationRef":"Applications","status":true,"icon":"fa fa-th-large","iconColour":"ffffff","applicationColour":"ffffff","routerLink":"Applications","applicationFeatures":null}, .... more here]

这是我的组件(几乎与工作的组件相同)。可以工作的组件通过标记(例如)包含在页面上,而不工作的组件则通过路由遍历来服务。

代码语言:javascript
复制
import {Component, OnInit} from 'angular2/core';

import {ApplicationVM} from '../ViewModels/Application.ViewModel';
import {ApplicationService}   from '../Services/application.service';

@Component({
    selector: 'ApplicationList',
    templateUrl: './app/Applications/Components/applications.html',
    providers: [ApplicationService]
})
export class ApplicationsComponent implements OnInit {

    constructor(private _applicationService: ApplicationService) { }

    errorMessage: string;
    applications: ApplicationVM[];

    ngOnInit() {
        console.log("INIT");
        this.getApplications();
    }

    listApps() {
        this.getApplications();
    }

    getApplications() {
        this._applicationService.getApplications()
            .subscribe(
            apps => this.applications = apps,
            error => this.errorMessage = <any>error);
    }

}
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-04-14 21:52:24

在WebEssentials中,浏览器链接或实时更新似乎是一个问题。重建的PC和没有问题(网络要领没有安装和其他设置没有改变)。

GitHub全文发布:https://github.com/angular/angular/issues/7983

票数 0
EN

Stack Overflow用户

发布于 2016-04-02 05:20:36

可能还有其他问题,因为它与<table><tbody>beta.13一起工作。

工作演示

代码语言:javascript
复制
<div class="route-container route-container-margin-0 route-container-width-standard">
    <div class="route-container-padding-standard">
        <p>hello world</p>
        <table>
            <tbody>
                <tr *ngFor="#app of users">
                    <td >
                        {{app.firstName}}
                    </td>
                </tr>
            </tbody>
        </table>
 </div>

最新情况:

http://plnkr.co/edit/XhH1jjnxGfLMX1CuBgHo?p=preview

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36366018

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档