Last active
December 21, 2015 19:29
-
-
Save achudars/6354471 to your computer and use it in GitHub Desktop.
AngularJS - usage of $http and getting data from an external file
This file contains hidden or 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
'use strict'; | |
/* Controllers */ | |
var app = angular.module('myApp.controllers', []); | |
app.controller('MyCtrl1', ['$scope', '$http', function($scope, as) { | |
as({method: 'GET', url: 'data/data.json'}). | |
success(function(data, status, headers, config) { | |
console.log(data); | |
$scope.data = data; | |
}). | |
error(function(data, status, headers, config) { | |
}); | |
}]); | |
app.controller('MyCtrl2', [function() { | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment