JohnnyTheTank / angular-footballdata-api-factory

AngularJS Factory for the football-data.org JSON REST API
MIT License
50 stars 20 forks source link

Installation trouble #3

Closed ZeroDarkThirty closed 7 years ago

ZeroDarkThirty commented 7 years ago

Hi,

I've done the first two steps of the installation (using npm) process, but I'm unsure as to how the third and fourth steps should work.

Do I have to add jtt_footballdata to the app.module.ts as a dependency? If so, then what should I use as the import statement?

Also, do I have to include a path to the js file in my .angular-cli.json file in the script array?

JohnnyTheTank commented 7 years ago

hi @ZeroDarkThirty this is a angular 1.x repo you can't use it in angular 2 or angular 4 project

ZeroDarkThirty commented 7 years ago

Oh I see. Any idea on how to make football-data api calls using angular 2/4?

JohnnyTheTank commented 7 years ago

you can do the api calls directly

ZeroDarkThirty commented 7 years ago

I haven't worked with external API in Angular before but I'm trying to figure it out. In my service I have this so far:

export class FootballService {
  private _url: string = "http://api.football-data.org/v1/competitions/426/leagueTable";
  constructor(private _http: Http) { }

  getLeagueTable(){
    return this._http.get(this._url)
            .map((res: Response) => res.json());
  }
}

Not sure if I'm on the right track or where the X-Auth-Token should go.

And in the component:

ngOnInit() {
    this._footyService.getTeamName()
      .subscribe(res => this.league = res); //league is an array
  }
JohnnyTheTank commented 7 years ago

sorry I have no time to help you here