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. 关于Vue懒加载问题

    有关Vue懒加载其实并不是想象的那么难和复杂: 首先引入 import  VueLazyLoad from 'vue-lazyload'; 其次是使用 Vue.use(VueLazyLoad,{ er ...

  2. win 10安装Linux虚拟机教程

    1.首先下载虚拟机 用的是VMware 官方下载地址:https://my.vmware.com/en/web/vmware/free#desktop_end_user_computing/vmwar ...

  3. nginx配置https访问

    一.准备 环境:centos6.8 nginx:1.13.6 二.开始       首先安装依赖包: yum install -y gcc gcc-c++ autoconf automake make ...

  4. sonarqube安装的坑

    1.按照官网安装 结果启动不了,看了log日志以后,发现是es报错,不能以root权限启动

  5. AttributeError: 'int' object has no attribute 'isdigit'(python下的isdigit函数)

    python下的isdigit函数:  isdigit() 方法检测字符串是否只由数字组成. 语法 isdigit()方法语法:  str.isdigit() 示例代码如下: 结果: 我想说的重点在于 ...

  6. Can't connect to MySQL server (10060) MySQL

    x 搜索了一下N篇解决方案都是在说以下3种原因... .{"防火墙的问题":["防火墙未关闭","服务器上防火墙端口未开放"]} 2.[&q ...

  7. QSS独门秘籍:subcontrol

    QSS是C++ Qt中的界面美化神器,其语法和CSS区别不大,但是QSS有一个独有的功能——subcontrol,这是CSS所没有的,一个widget往往由多个子部件构成,利用subcontrol可以 ...

  8. C#编程基础(简单概述与理解)

    1.C#变量和数据输入 C#常用到的几个数据类型: 整型:int 说明:32位有符号整数 范围:-2³¹~2³¹-1 浮点型:double 说明:64位双精度浮点数 范围:±5.0×10-­﹣³²~± ...

  9. nginx配置虚拟主机vhost的方法详解

    Nginx vhost配置,可实现基于ip.端口号.servername的虚拟主机,同时可避免直接修改主配置文件.在nginx下配置虚拟主机vhost非常方便.这篇文章主要介绍了nginx配置虚拟主机 ...

  10. RabbitMQ:Docker环境下搭建rabbitmq集群

    RabbitMQ作为专业级消息队列:如何在微服务框架下搭建 使用组件 文档: https://github.com/bijukunjummen/docker-rabbitmq-cluster 下载镜像 ...