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. ajax方式提交表单数据并判断当前注册用户是否存在

    项目的目录结构 源代码: regservlet.java package register; import java.io.IOException; import java.io.PrintWrite ...

  2. Docker win10安装

    因为虚拟机还没装好,所以现在win10上安装Docker 1.首先下载Docker Toolbox,因为Docker for windows需要win10专业版或者其他64位版本,我的系统虽然也是wi ...

  3. IBM Installation Manager 工具概述(转)

    IBM Installation Manager 工具概述 IBM Installation Manager 是一款可运行在多种平台(如 IBM i. z/OS. Windows. Linux.Uni ...

  4. finance1:专业词汇

    1,沙盘演练:沙盘演练又叫沙盘模拟培训.沙盘推演,源自西方军事上的战争沙盘模拟推演,是通过引领学员进入一个模拟的竞争性行业,由学员分组建立若干模拟公司,围绕形象直观的沙盘教具,实战演练模拟企业的经营管 ...

  5. 如何生成Junit报告

    前言: 对Eclipse的工程写单元测试: 1. 一个工程有多个测试类,将测试类放到一个测试包下. 2. 每一个测试类写好,都单独执行run as ->JUnit Test测一下.    3. ...

  6. 在window 2008r2开发服务器上安装MSMQ消息队列

    1.打开”服务器管理器“------”功能“-------”添加功能“,勾选”消息队列“,如下图: 如果之前已经勾选,则忽略此步. 2.”功能“------”消息队列“------”专有对列“---- ...

  7. 认识Charles-proxy 抓包工具

    1.为什么不用 Fiddler 抓包工具? 在这里说明一下,因为Fiddler 抓包工具使用C#语言写的,不能在  MAC 上运行,而   Charles-proxy  他是 java  开发的,可以 ...

  8. 软件加密工具-Virbox 开发者工具盒

    功能 Virbox 开发者工具盒是由深思数盾研发的一套软件加密工具,将加壳工具.API文档及操作流程文档等集成在一起,方便软件开发者使用. 您可以通过 Virbox 开发者工具盒实现: dll.exe ...

  9. openshift 容器云从入门到崩溃之六《Source-to-Image》

    上次说到了怎么在oc上面部署应用而且说道了怎么定义模板部署应用,也许你会奇怪那个我代码打包编译在哪一步,那就要说道oc的s2i流程了 下面是基本s2i流程 1.制作base-image镜像 要使用s2 ...

  10. Python Pyinstaller打包含pandas库的py文件遇到的坑

    今天的主角依然是pyinstaller打包工具,为了让pyinstaller打包后exe文件不至过大,我们的py脚本文件引用库时尽可能只引用需要的部分,不要引用整个库,多使用“from *** imp ...