mirror of
https://github.com/wu736139669/vczero.github.io.git
synced 2026-08-05 06:23:38 +00:00
20 lines
593 B
JavaScript
20 lines
593 B
JavaScript
/*构建movieList服务*/
|
|
app.factory('movieList', ['$rootScope', '$http', 'ServiceConfig', function($rootScope, $http, ServiceConfig){
|
|
$rootScope.isNoLoaded = true;
|
|
var _MovieList = {
|
|
getData: function(keywords){
|
|
$rootScope.isNoLoaded = true;
|
|
$http.jsonp(ServiceConfig.movie_search + '?callback=movieSearch&count=5&q=' + keywords);
|
|
|
|
window.movieSearch = function(data){
|
|
$rootScope.isNoLoaded = false;
|
|
if(data.subjects && data.subjects.length){
|
|
$rootScope.movieList = data.subjects;
|
|
}
|
|
console.log(data.subjects);
|
|
};
|
|
}
|
|
};
|
|
|
|
return _MovieList;
|
|
}]); |