Twitter bootstrap Angular2模板解析错误EOF
在Angular2(beta 13)中,我试图显示从数据库检索的数据项列表。这部分工作正常 但是,当我试图在html表中显示这些项目(应用程序名称)时,它不起作用。奇怪的是,它在列表中显示时确实起作用 错误消息Twitter bootstrap Angular2模板解析错误EOF,twitter-bootstrap,typescript,angular,eof,Twitter Bootstrap,Typescript,Angular,Eof,在Angular2(beta 13)中,我试图显示从数据库检索的数据项列表。这部分工作正常 但是,当我试图在html表中显示这些项目(应用程序名称)时,它不起作用。奇怪的是,它在列表中显示时确实起作用 错误消息 EXCEPTION: Template parse errors: Unexpected character "EOF" (" </table> </div> </div[ERROR ->]"): ApplicationsCom
EXCEPTION: Template parse errors:
Unexpected character "EOF" ("
</table>
</div>
</div[ERROR ->]"): ApplicationsComponent@13:5
这是我的组件(与工作的组件几乎相同)。
工作的组件通过标签包含在页面上,而不工作的组件通过路由遍历提供服务
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);
}
}
从'angular2/core'导入{Component,OnInit};
从“../ViewModels/Application.ViewModel”导入{ApplicationVM};
从“../Services/application.service”导入{ApplicationService};
@组成部分({
选择器:“应用程序列表”,
templateUrl:'./app/Applications/Components/Applications.html',
提供者:[应用程序服务]
})
导出类ApplicationComponent实现OnInit{
构造函数(私有_应用程序服务:应用程序服务){}
错误消息:字符串;
应用程序:ApplicationVM[];
恩戈尼尼特(){
console.log(“INIT”);
这是getApplications();
}
listApps(){
这是getApplications();
}
getApplications(){
这是。_applicationService.getApplications()
.订阅(
apps=>this.applications=apps,
error=>this.errorMessage=error);
}
}
可能还有其他问题,因为它与和beta.13一起工作
<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>
你好,世界
{{app.firstName}
更新:
可能还有其他问题,因为它与
和beta.13一起工作
<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>
你好,世界
{{app.firstName}
更新:
WebEssentials中的浏览器链接或实时更新似乎有问题。重建电脑,无问题(未安装web essentials,其他设置未更改)
GitHub发布全文:
WebEssentials中的浏览器链接或实时更新似乎有问题。重建电脑,无问题(未安装web essentials,其他设置未更改)
GitHub发布全文:
能否在{{app?.name}}
中重现问题?app指的是#app。name指的是json数据(我已经在上面的示例中添加了这个),您能否在{{app?.name}
??app指的是#app中重现这个问题。name指的是json数据(我在上面的示例中添加了这个),它在一个页面中工作,但在另一个页面中不工作,即显示为表。初始页面很好,然后我浏览到另一个页面,它停止工作。我正在使用一个共享服务,它似乎在两个页面上都调用fine(尝试调整代码以手动设置数据,但也没有效果)。真的有一些偷偷摸摸的事情发生——我通常不会被困这么久。这几乎是相同的组件代码来服务的网页,工作和不工作,也没有404。必须有一些其他问题。将做。如果将模板html输入到组件内的多行模板中,但当它位于单独的html文件中时,则出现错误的页面将正常工作。那里会出什么问题?啊!请确保在HTML文件中正确写入每个标记。我不认为会有单独的文件问题!检查我的枪。我用一个单独的html文件更新了它。它在一个页面中工作,但在另一个页面中不工作,即显示为表格。初始页面很好,然后我浏览到另一个页面,它停止工作。我正在使用一个共享服务,它似乎在两个页面上都调用fine(尝试调整代码以手动设置数据,但也没有效果)。真的有一些偷偷摸摸的事情发生——我通常不会被困这么久。这几乎是相同的组件代码来服务的网页,工作和不工作,也没有404。必须有一些其他问题。将做。如果将模板html输入到组件内的多行模板中,但当它位于单独的html文件中时,则出现错误的页面将正常工作。那里会出什么问题?啊!请确保在HTML文件中正确写入每个标记。我不认为会有单独的文件问题!检查我的枪。我用一个单独的html文件更新了它。
[{"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]
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);
}
}
<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>