Skip to content

Instantly share code, notes, and snippets.

@Charlyzzz
Last active September 20, 2015 21:15
Show Gist options
  • Save Charlyzzz/92ef1277f520c827839e to your computer and use it in GitHub Desktop.
Save Charlyzzz/92ef1277f520c827839e to your computer and use it in GitHub Desktop.
angularjs
///////services.js/////////
app.service('twitterService', function($http) {
var self = this;
this.findAll = function() {
return $http.get('/Alltweets') });
};
});
///////controllers.js/////////
'use strict';
app.controller('TwitterController', function($scope, twitterService) {
twitterService.findall().success(function(response) {
$scope.tweets = response.data;
});
});
///////Vista/////////
[...]
<body ng-controller="TwitterController">
<div ng-repeat="t in tweets">{{t|json}}</div>
[...]
///////Xtend/////////
@Get('/Alltweets')
def Result tweets() {
response.contentType = ContentType.APPLICATION_JSON
ok(RepositorioTweet.allTweets.toJson)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment