48分布式电商项目 - 搜索页与首页对接
2023-09-11 14:15:41 时间
需求:用户在首页的搜索框输入关键字,点击搜索后自动跳转到搜索页查询
首页传递关键字
contentController.js:
//搜索跳转
$scope.search=function(){
location.href="http://localhost:9104/search.html#?keywords="+$scope.keywords;
}
index.html
<div class="input-append">
<input type="text" id="autocomplete" type="text" ng-model="keywords" class="input-error input-xxlarge" />
<button class="sui-btn btn-xlarge btn-danger" ng-click="search()" type="button">
搜索
</button>
</div>
搜索页接收关键字
searchController.js:
添加 location 服务用于接收参数
app.controller('searchController',function($scope,$location,searchService){
......
接收参数并进行查询
//加载查询字符串
$scope.loadkeywords=function(){
$scope.searchMap.keywords= $location.search()['keywords'];
$scope.search();
}
相关文章
- BroadLeaf项目搜索功能改进
- 编程IDE中ctrl+shift+F无法实现全局搜索解决办法
- 使用Bootstrap typeahead插件实现搜索框自动补全的配置参数。
- 基于mongodb的搜索分页
- 在eclipse里搜索maven项目需要的dependency
- PostgreSQL 在视频、图片去重,图像搜索业务中的应用
- Java实现 LeetCode 538 把二叉搜索树转换为累加树(遍历树)
- Java实现 LeetCode 240 搜索二维矩阵 II(二)
- 搜索结果页面关键字加红加粗
- 如何使用ABAP Restful API进行代码的全文搜索
- Atitit 软件项目的一整套解决方案(gui界面,中间,存储数据库,图像处理,全文搜索)attilax总结
- atitit.vod search doc.doc 点播系统搜索功能设计文档
- Python实现直方图梯度提升回归模型(HistGradientBoostingRegressor算法)并基于网格搜索进行优化同时绘制PDP依赖图项目实战
- [Elasticsearch] 多字段搜索 (三) - multi_match查询和多数字段
- 数据结构和算法 十六、指数查找/跳转搜索/鞍背搜索