Files
vczero.github.io/t/lib/list/searchController.js
T
2014-12-11 00:12:26 +08:00

25 lines
765 B
JavaScript

/*搜索*/
app.controller('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.music);
}
};
});