mirror of
https://github.com/wu736139669/vczero.github.io.git
synced 2026-08-05 06:23:38 +00:00
29 lines
912 B
JavaScript
29 lines
912 B
JavaScript
/*搜索*/
|
|
var SearchController = function($scope, $rootScope, $location, bookList, musicList, movieList){
|
|
var path = $location.path();
|
|
$scope.search = function(){
|
|
var keywords = $scope.keywords;
|
|
if(path.indexOf('/book') !== -1 || path === '/'){
|
|
if(keywords){
|
|
$rootScope.keywordsObj.book = keywords;
|
|
}
|
|
bookList.getData($rootScope.keywordsObj.book);
|
|
|
|
}else if(path.indexOf('/music') !== -1 || path === '/music'){
|
|
if(keywords){
|
|
$rootScope.keywordsObj.music = keywords;
|
|
}
|
|
musicList.getData($rootScope.keywordsObj.music);
|
|
|
|
}else if(path.indexOf('/movie') !== -1 || path === '/movie'){
|
|
if(keywords){
|
|
$rootScope.keywordsObj.movie = keywords;
|
|
}
|
|
movieList.getData($rootScope.keywordsObj.movie);
|
|
}
|
|
};
|
|
};
|
|
|
|
SearchController.$inject = ['$scope', '$rootScope', '$location', 'bookList', 'musicList', 'movieList'];
|
|
app.controller('SearchController', SearchController);
|