mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
26 lines
543 B
JavaScript
26 lines
543 B
JavaScript
angular.module('ionic.twitter', ['ngTouch', 'ngResource'])
|
|
|
|
.factory('TweetSearcher', function($resource) {
|
|
var searchResource = $resource('http://search.twitter.com/:action', {
|
|
action: 'search.json',
|
|
callback:'JSON_CALLBACK'
|
|
}, {
|
|
get: {
|
|
method:'JSONP'
|
|
}
|
|
});
|
|
|
|
return {
|
|
search: function(query) {
|
|
return searchResource.query({
|
|
q: 'Cats'
|
|
})
|
|
}
|
|
}
|
|
})
|
|
|
|
.controller('SearchCtrl', function($scope, TweetSearcher) {
|
|
$scope.search = function(query) {
|
|
TweetSearcher.search(query);
|
|
};
|
|
}); |