Skip to content

Instantly share code, notes, and snippets.

@niniyzni
Created August 11, 2018 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niniyzni/2773b28246ae629dd83b8d6aa5e57185 to your computer and use it in GitHub Desktop.
Save niniyzni/2773b28246ae629dd83b8d6aa5e57185 to your computer and use it in GitHub Desktop.
import { Component } from "@angular/core";
import { AppService } from "./app.service";
import { Http, Response } from "@angular/http";
@Component({
selector: "app-root",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.css"]
})
export class AppComponent {
title = "Angular Coding Exercise 6";
constructor(private appService: AppService, private http: Http) {}
navItems: any;
myFunc() {
console.log("function called");
// this.navItems = this.http.get("../res/data.json");
// console.log("this.navItems--->", this.navItems);
this.http
.get(
"https://cors-anywhere.herokuapp.com/http://services.groupkt.com/state/get/USA/all"
)
.subscribe(data => {
console.log("data-------->", data);
let result = data;
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment