小编raf*_*fal的帖子

Angular 4 - ERROR TypeError,ERROR CONTEXT DebugContext_

我是Angular 4的新秀,我需要一些帮助.我在控制台中的代码显示错误但在我的模板中一切显示正确.有人能帮我理解发生了什么吗?

错误

ERROR TypeError: Cannot read property 'Tytul' of undefined
NewsDetailsComponent.html:7 ERROR CONTEXT DebugContext_ {view: Object, nodeIndex: 12, nodeDef: Object, elDef: Object, elView: Object}
Run Code Online (Sandbox Code Playgroud)

news.ts

export interface News {
Ident: number;
Tytul: string;
Tresc: string;
Data: string;
Run Code Online (Sandbox Code Playgroud)

}

news.service.ts

import { Injectable } from '@angular/core';
import { Http, Response, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/Rx';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';

import { News } from './news';

@Injectable()

export class NewsService {

private newsUrl …
Run Code Online (Sandbox Code Playgroud)

json observable typescript angular

15
推荐指数
1
解决办法
2万
查看次数

标签 统计

angular ×1

json ×1

observable ×1

typescript ×1