Oops! I made a mistake and typed :
instead of =
on line 2 of this code snippet.
Why does Typescript allow this error? Isn't colon supposed to indicate a known Type for a property declaration?
I'm pretty sure there's a reason encoded in the TS spec, but what could that be?
export class CategoriesService {
private _url : "http://localhost:3000/someurl"; // ???????????
constructor(private http: Http) {}
getData(): Observable<Category[]> {
return this.http.get(this._url).map(res => res.json()); //fails here, as _url is undefined
}
}