Md. Nahidur Rahman Md. Nahidur Rahman - 2 months ago 5x
JSON Question

HTTP Get in AngularJs Could not located the Json file

I have tried several times with the following code to get the json data.

var todoApp = angular.module("todoApp", []);$http) {

$http.get('todo.json').success(function (data) {

model.items = data;

here todo.json file is located on the root of the project....what wrong i am doing?


if you are using visual studio with IIS Express to debug then you will have to add a mime type for the static json file otherwise this debug server wont know how to handle the request for this type of file. you can do by

1.Adding a new web config file in your project (if it dosent exist)
2.Adding this inside the file

      <mimeMap fileExtension=".json" mimeType="text/json" />

under config section / tag. More info about this here