I have a TypeScript file containing user data:
File path: quickstart-muster/app/mock/user.mock.ts
import {User} from "../user";
export const USERS:User[]=[
new User(....);
];
I have a service set up at: quickstart-muster/app/services/user.service.ts
import { Injectable } from '@angular/core';
import {Observable} from "rxjs/Observable"
import 'rxjs/add/operator/map';
import 'rxjs/add/observable/fromPromise';
import 'rxjs/add/operator/toPromise';
import {Http} from "@angular/http";
import {User} from "../user";
@Injectable()
export class UserService {
constructor(private http:Http){}
public loadUsers():Observable<User[]>{
return this.http.get('../mock/user.mock.ts')
.map(res=>res.json());
}
}
I am facing an issue where I receive a 404 error stating that the file .../mock/user.mock.ts cannot be found.
How can I resolve this issue and make it work?