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移动端项目(二)的更多相关文章

  1. angular --- s3core移动端项目(三)

    angular.module('myApp') .directive('listActive',functon(){ return { restrict:'A', scope:{ listActive ...

  2. angular --- s3core移动端项目

    因为记性不好的原因做个草稿笔记 app.js中 var myApp = angular.module('myApp',['ui.router','oc.lazyLoad','ngAnimate','数 ...

  3. 【angularjs】使用ionic+angular 搭建移动端项目,字体适配

    解析: 首先,rem是以html为基准. 一般的,各大主流浏览器的font-size默认值为16px,此时1rem=16px.如果此时将rem与px进行换算很麻烦,比如0.75rem=12px. 为了 ...

  4. 【angularjs】使用angular搭建PC端项目,开关按钮

    方法一(使用指令) 1.指令(angular-ui-switch.js) angular.module('uiSwitch', []) app.directive('switch', function ...

  5. 17.vue移动端项目二

    FilmList.vue 电影列表 <template> <div class="mz-film-list"> <!-- 正在热映 https://m ...

  6. vue-cli 移动端项目如何在手机上调试预览

    这里分享下如何在webpack工具构建下的vue项目,在手机端调试和预览,言归正传. 1.电脑和手机连接到同一个WIFI a.台式电脑和手机同时链接一个路由器,使用同一个wifi: b.笔记本也可以直 ...

  7. 使用Vue2+webpack+Es6快速开发一个移动端项目,封装属于自己的jsonpAPI和手势响应式组件

    导语 最近看到不少使用vue制作的音乐播放器,挺好玩的,本来工作中也经常使用Vue,一起交流学习,好的话点个star哦 本项目特点如下 : 1. 原生js封装自己的跨域请求函数,支持promise调用 ...

  8. 曾经的pc端项目踩到的一些兼容性的坑及其解决方案

    曾经公司pc端项目一直最低兼容到IE7,要求和chrome下浏览效果一致,真心坑坏了我和另外一个小伙伴(另一个小伙伴以前也没处理过兼容问题).不过还好,在这里真心感谢鑫哥博客的详解,从底层原理讲到了具 ...

  9. Eclipse+Maven创建webapp项目<二> (转)

    Eclipse+Maven创建webapp项目<二> 1.开启eclipse,右键new——>other,如下图找到maven project 2.选择maven project,显 ...

随机推荐

  1. Ubuntu常用操作命令

    解压文件: tar -zxvf 文件名 -C 指定目录 从当前环境进入root环境: su,然后输入root密码

  2. PHP(表单元素)

    表单: 1.收集用户的输入,发送到后台 <form action="后台地址" method="提交方式" enctype="multipart ...

  3. Python学习之旅(十七)

    Python基础知识(16):面向对象编程(Ⅰ) 类和实例 类是抽象的模板 实例是根据类创建出来的一个个具体的对象,每个对象都拥有相同的方法,但各自的数据可能不同. 类可以在创建实例的时候,把一些我们 ...

  4. Excel GET.DOCUMENT说明

    GET.DOCUMENT(type_num, name_text) Type_num    指明信息类型的数.下表列出 type_num 的可能值与对应结果. Type_num        返回 1 ...

  5. oracle索引分类

    参考文档:https://wenku.baidu.com/view/d4d6ee1ba76e58fafab00336.html https://blog.csdn.net/u010719917/art ...

  6. C和C指针小记(十六)-动态内存分配

    动态内存分配 1.1 为什么使用动态内存分配 直接声明数组的方式的缺点: 1) 声明数组必须指定长度限制.无法处理超过声明长度的数组. 2) 如果声明更大的常量来弥补第一个缺点,会造成更多的内存浪费. ...

  7. xss脚本绕过限制的方法

    第一关:第一关比较简单,直接写入标签就可以,这里不多说了,payload如下: http://sqler.win/xss/level1.php?name=test%3Csvg/onload=alert ...

  8. DEDE暴力破解后台登录页面

    DEDE暴力破解后台登录页面 #!/usr/bin/env python '''/* * author = Mochazz * team = 红日安全团队 * env = pyton3 * */ '' ...

  9. Jmeter学习之-获取登录的oken值(2)

    此篇介绍获取登录token的第二种方式--json提取器提取 PS:此方法针对接口返回值为json串格式 在登录请求上右键添加JSON提取器                               ...

  10. python线程、协程、I/O多路复用

    目录: 并发多线程 协程 I/O多路复用(未完成,待续) 一.并发多线程 1.线程简述: 一条流水线的执行过程是一个线程,一条流水线必须属于一个车间,一个车间的运行过程就是一个进程(一个进程内至少一个 ...