angular --- s3core移动端项目(二)
product-ctrl.js
angular.modules('myApp').controller('ProductCtrl',['$scope','$rootScope','$timeout','$state','$istore','$modal','$number','ProductService',
functon($scope,$rootScope,$timeout,$state,$istore,$modal,$number,ProductService){
//全局参数
$scope.page = 0;
$scope.key = ";
//获取分类
$scope.showCateList = function(){
if(!$scope.first){
var promise = ProductService.getCateGoryInfo();
promise.then(function(result){
var cateData = result.dataList;
var first = [],seconds = [];
cateData.foeEach(function(item){
if (item.level === '1') firsts.push(item);
if (item.level === '2') seconds.push(item);
})
firsts.foeEach(function(item){
var childs = findChild(item,seconds);
item.child = childs
})
function findChilds(firsts,seconds){
var childs = [];
seconds.forEach(function(item){
if (item.pId === first.id) childs.push(item)
})
return childs;
}
$scope.firsts = firsts;
if (firsts.length > 0) {
$scope.firstChecked = firsts[0];
$scope.seconds = $scope.firstChecked.childs;
}
})
}
$scope.showSearchTypeBody = true;
}
$scope.changeSearchType = function(first){
$scope.firstChecked = first;
$scope.seconds = first.childs;
}
$scope.checkSecond = function(secondChecked){
$scope.secondChecked = secondChecked;
}
}])
//product-ctrl.js
angular.modules('myApp').controller('ProductCtrl',['$scope','$rootScope','$timeout','$state','$istore','$modal','$number','ProductService',
functon($scope,$rootScope,$timeout,$state,$istore,$modal,$number,ProductService){ //全局参数 $scope.page = 0; $scope.key = ''; //获取分类,分类有一级分类与一级分类下的分类 $scope.showCateList = function(){ if(!$scope.first){ var promise = ProductService.getCateGoryInfo(); promise.then(function(result){ var cateData = result.dataList; var firsts = [],seconds = [];cateData.foeEach(function(item){if (item.level === '1') firsts.push(item);if (item.level === '2') seconds.push(item);})firsts.foeEach(function(item){var childs = findChild(item,seconds);item.child = childs})
function findChilds(firsts,seconds){var childs = [];seconds.forEach(function(item){if (item.pId === first.id) childs.push(item)})return childs;}
$scope.firsts = firsts;if (firsts.length > 0) {$scope.firstChecked = firsts[0];$scope.seconds = $scope.firstChecked.childs;} }) }$scope.showSearchTypeBody = true; }$scope.changeSearchType = function(first){$scope.firstChecked = first;$scope.seconds = first.childs;}$scope.checkSecond = function(secondChecked){$scope.secondChecked = secondChecked;}
}])
angular --- s3core移动端项目(二)的更多相关文章
- angular --- s3core移动端项目(三)
angular.module('myApp') .directive('listActive',functon(){ return { restrict:'A', scope:{ listActive ...
- angular --- s3core移动端项目
因为记性不好的原因做个草稿笔记 app.js中 var myApp = angular.module('myApp',['ui.router','oc.lazyLoad','ngAnimate','数 ...
- 【angularjs】使用ionic+angular 搭建移动端项目,字体适配
解析: 首先,rem是以html为基准. 一般的,各大主流浏览器的font-size默认值为16px,此时1rem=16px.如果此时将rem与px进行换算很麻烦,比如0.75rem=12px. 为了 ...
- 【angularjs】使用angular搭建PC端项目,开关按钮
方法一(使用指令) 1.指令(angular-ui-switch.js) angular.module('uiSwitch', []) app.directive('switch', function ...
- 17.vue移动端项目二
FilmList.vue 电影列表 <template> <div class="mz-film-list"> <!-- 正在热映 https://m ...
- vue-cli 移动端项目如何在手机上调试预览
这里分享下如何在webpack工具构建下的vue项目,在手机端调试和预览,言归正传. 1.电脑和手机连接到同一个WIFI a.台式电脑和手机同时链接一个路由器,使用同一个wifi: b.笔记本也可以直 ...
- 使用Vue2+webpack+Es6快速开发一个移动端项目,封装属于自己的jsonpAPI和手势响应式组件
导语 最近看到不少使用vue制作的音乐播放器,挺好玩的,本来工作中也经常使用Vue,一起交流学习,好的话点个star哦 本项目特点如下 : 1. 原生js封装自己的跨域请求函数,支持promise调用 ...
- 曾经的pc端项目踩到的一些兼容性的坑及其解决方案
曾经公司pc端项目一直最低兼容到IE7,要求和chrome下浏览效果一致,真心坑坏了我和另外一个小伙伴(另一个小伙伴以前也没处理过兼容问题).不过还好,在这里真心感谢鑫哥博客的详解,从底层原理讲到了具 ...
- Eclipse+Maven创建webapp项目<二> (转)
Eclipse+Maven创建webapp项目<二> 1.开启eclipse,右键new——>other,如下图找到maven project 2.选择maven project,显 ...
随机推荐
- php const常量 不能使用字符串连接符.链接
class jdpay extends pay { const BASE_URL = "https://mapi.jdpay.com/npp10/"; private $agree ...
- 20165311 ch02 课下作业
补充完成课上测试(不能只有截图,要有分析,问题解决过程,新学到的知识点) 完成教材 p97 2.96 2.97,要有完备的
- socket 编程中。 服务端用到多线程
客户端连接服务端之后, 服务端会生成与客户端交换信息的socket. 在服务端实现多线程: 为每个连接创建一个线程进行信息交换. import threading from socket import ...
- fiddler的一些记录
通过execaction.exe可以给fiddler发命令,控制抓包开始和停止 https://stackoverflow.com/questions/29916508/start-and-stop- ...
- weui开发笔记
1.标准的weui只是一个css皮肤,当然里面有h5特性所以有一些很好的组件,比如时间选择控件.数字输入框(用于手机号等),在ios——微信中可以做到完美的展示. 2.ui框架以手机移动端为优先显示( ...
- c语言实现wc功能
本随笔对网站http://blog.chinaunix.net/uid-22566367-id-381958.html有所借鉴 #include <stdio.h> #define BEG ...
- 18.0-uC/OS-III挂起内核对象
任务等待多个对象.然而, uC/OS-III只允许同时等待多个信号量和消息队列.换句话说,不能同时等待多个事件标志组或mutex. 1.任务可以同时等待多个信号量和消息队列. 任务接收到一个信号量或消 ...
- java框架之SpringBoot(11)-缓存抽象及整合Redis
Spring缓存抽象 介绍 Spring 从 3.1 版本开始定义了 org.springframework.cache.Cache 和 org.springframework.cache.Cache ...
- python基础(17)-IO模型&selector模块
先说一下IO发生时涉及的对象和步骤.对于一个network IO (这里我们以read举例),它会涉及到两个系统对象,一个是调用这个IO的process (or thread),另一个就是系统内核(k ...
- DAX/PowerBI系列 - 累计总计(Cumulative Total)
DAX/PowerBI系列 - 累计总计(Cumulative Total) 2017/07/23 更新:B列公式(见最后) 难度: ★★☆☆☆(2星) 适用: ★★☆☆☆(2星) 概况: 这个模式普 ...