Skip to content

Instantly share code, notes, and snippets.

@ccit-spence
Last active August 29, 2015 13:57
Show Gist options
  • Save ccit-spence/9715311 to your computer and use it in GitHub Desktop.
Save ccit-spence/9715311 to your computer and use it in GitHub Desktop.
curl -i -H "Accept: application/json" localhost:8080/rest-app2/users
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Sat, 22 Mar 2014 21:55:29 GMT
[{"class":"rest.app2.User","id":1,"firstName":"Jane","lastName":"Doe"},{"class":"rest.app2.User","id":2,"firstName":"John","lastName":"Doe"},{"class":"rest.app2.User","id":3,"firstName":"Daffy","lastName":"Duck"}]
angular.module('quick-demo', ['ui.bootstrap','ui.utils','ngRoute','ngAnimate']);
angular.module('quick-demo')
.config(function($routeProvider) {
'use strict';
$routeProvider.
when('/',{
templateUrl: 'views/index/index.tpl.html',
controller: 'indexController'
}).
when('/ili',{
templateUrl: 'views/ili/ili.tpl.html',
controller: 'iliController'
}).
/* Add New Routes Above */
otherwise({redirectTo:'/'});
});
angular.module('quick-demo').config(['$httpProvider', function($httpProvider) {
'use strict';
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
}]);
angular.module('quick-demo').run(function($rootScope) {
'use strict';
$rootScope.safeApply = function(fn) {
var phase = $rootScope.$$phase;
if (phase === '$apply' || phase === '$digest') {
if (fn && (typeof(fn) === 'function')) {
fn();
}
} else {
this.$apply(fn);
}
};
});
(function () {
'use strict';
angular.module('quick-demo').controller('iliController',function($scope, $http){
$http({
method: 'GET',
url: 'http://localhost:8080/rest-app2/users',
headers: {
'Accept': 'application/json'
}
}).success(function (data) {
$scope.data = data;
}).error(function(error){
$scope.error = error;
});
});
}());
<div class="col-md-12">
<h1>ili view</h1>
<p>This is the base template for your new view.</p>
<div ng-repeat="user in data">
<p>{{user.firstName}} {{user.lastName}}</p>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment