Created
March 12, 2013 22:38
-
-
Save sirkitree/5147740 to your computer and use it in GitHub Desktop.
A CodePen by Jerad Bitner.
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
<html> | |
<body ng-app="nodes"> | |
<div class="hero-unit" ng-controller="RecipeCtrl"> | |
<button ng-click="useResource()">$resource request</button> | |
<ul> | |
<li ng-repeat="recipe in recipes.list">{{recipe.title}}</li> | |
</ul> | |
</div> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js"></script> | |
<script src="http://code.angularjs.org/1.0.5/angular-resource.min.js"></script> | |
</body> | |
</html> |
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
var url = "http://copelandia.lulladev.com"; | |
angular | |
.module('nodes', ['ngResource']) | |
.controller('RecipeCtrl', function($scope, $resource, $http) { | |
delete $http.defaults.headers.common['X-Requested-With']; | |
$scope.useResource = function() { | |
var Nodes = $resource( | |
url + '/node.json', {}, | |
{ get: { method: 'JSONP' } } | |
); | |
$scope.recipes = Nodes.get({limit: 25}); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment