mirror of
https://github.com/wu736139669/vczero.github.io.git
synced 2026-08-05 06:23:38 +00:00
29 lines
817 B
JavaScript
29 lines
817 B
JavaScript
/*负责搜索结果的导向*/
|
|
var Search = function($scope, $rootScope, $location, bookList, musicList, movieList){
|
|
var path = $location.path();
|
|
$rootScope.isNoLoaded = false;
|
|
//跳回列表页
|
|
$scope.search = function(){
|
|
var keywords = $scope.keywords;
|
|
if(path.indexOf('/book') !== -1){
|
|
if(keywords){
|
|
$rootScope.keywordsObj.book = keywords;
|
|
}
|
|
$location.path('/book');
|
|
|
|
}else if(path.indexOf('/music') !== -1){
|
|
if(keywords){
|
|
$rootScope.keywordsObj.music = keywords;
|
|
}
|
|
$location.path('/music');
|
|
|
|
}else if(path.indexOf('/movie') !== -1){
|
|
if(keywords){
|
|
$rootScope.keywordsObj.movie = keywords;
|
|
}
|
|
$location.path('/movie');
|
|
}
|
|
};
|
|
};
|
|
Search.$inject = ['$scope', '$rootScope', '$location', 'bookList', 'musicList', 'movieList'];
|
|
app.controller('Search', Search); |