Json 使用RESTAPI中的angular 2数据

Json 使用RESTAPI中的angular 2数据,json,rest,typescript,angular,Json,Rest,Typescript,Angular,我从Angular 2开始,第一次我尝试从JSON文件中获取数据并将其显示在一个表上,现在我想从rest api获取数据,所以我从实体类创建Restful Web服务,生成CrossOriginResourceSharingFilter(我使用netbeans和glassfish),并获得JSON输出的链接,我在angular 2中替换了api url中的链接,但它不起作用 这是在我的2个雇员服务 @Injectable() 出口类雇员服务{ private Empsur='localhost

我从Angular 2开始,第一次我尝试从JSON文件中获取数据并将其显示在一个表上,现在我想从rest api获取数据,所以我从实体类创建Restful Web服务,生成CrossOriginResourceSharingFilter(我使用netbeans和glassfish),并获得JSON输出的链接,我在angular 2中替换了api url中的链接,但它不起作用 这是在我的2个雇员服务

@Injectable()
出口类雇员服务{
private Empsur='localhost:25176/WebApplication4/app/employes';//指向web api的URL
构造函数(私有http:http){}
getEmployes(){
返回this.http.get(this.empUrl)
.map(res=>res.json())
.接住(这个.把手错误);

}
请将图像中的代码直接添加到您的问题中。另外,请向我们展示您的
应用程序/app.component.html
,因为这是发生异常的地方。@rinukkusu my app.component.html具有EmployeesComponent[routerLink]=“['Employes']那么在你的
app/app.component.html
中的
第154行有什么内容呢