Created
August 11, 2018 19:04
-
-
Save niniyzni/2773b28246ae629dd83b8d6aa5e57185 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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