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. 树状数组 || 线段树 || Luogu P5200 [USACO19JAN]Sleepy Cow Sorting

    题面:P5200 [USACO19JAN]Sleepy Cow Sorting 题解: 最小操作次数(记为k)即为将序列倒着找第一个P[i]>P[i+1]的下标,然后将序列分成三部分:前缀部分( ...

  2. Spring Enable* 注解

    Spring提供了一系列以Enable开头的注解,这些注解本质上是激活Spring的某些管理功能.比如,EnableWebMvc. 这个注解引入了MVC框架在Spring 应用中需要用到的所有bean ...

  3. 前端模板 artTemplate之辅助方法template.helper

    var labelMap = { onlinePayment:{ label:"在线支付", desc:"支持大部分储蓄卡.信用卡及第三方平台支付", name ...

  4. HTML轮播图实现(前后端分离)

    1,首先前后端分离用到了3个插件 2,异步请求后端获取数据库图片地址(图片名字) //图片轮播 axios({ url:'http://127.0.0.1:8000/userctrl/image', ...

  5. 剑指offer-复杂链表的复制

    题目描述 输入一个复杂链表(每个节点中有节点值,以及两个指针,一个指向下一个节点,另一个特殊指针指向任意一个节点),返回结果为复制后复杂链表的head.(注意,输出结果中请不要返回参数中的节点引用,否 ...

  6. javaweb(1)之tomcat使用

    安装 1.点击下载. 2.解压到一个目录. 3.进入解压后的 bin 目录,双击该文件夹下的 startup.bat 即可运行. 4.若运行成功,会有一个窗口悬停如下: 访问地址: localhost ...

  7. 关于容器类型数据的强转一共:str() list() set() tuple() dict() 都可以转换成对应的数据类型 /Number 数据类型的强转一共: int() bool() flaot() complex() 都可以转换成对应的数据类型

    # ###强制转换成字典类型 # 多级容器数据:该类型是容器数据,并且里面的元素还是容器类型数据 # ###二级容器 # 二级列表 listvar = [1,3,4,5,[6,7,8,9]] res ...

  8. 【UML】NO.51.EBook.5.UML.1.011-【UML 大战需求分析】- 时序图(Timing Diagram)

    1.0.0 Summary Tittle:[UML]NO.51.EBook.1.UML.1.011-[UML 大战需求分析]- 时序图(Timing Diagram) Style:DesignPatt ...

  9. 非CI执行Allure2 trends空白问题

    问题描述 未使用CI工具集成Aluure运行测试用例并生成Allure报告,多次执行后,trends是空白的,未展示出期望的趋势图 问题原因非CI工具,是通过命令 allure serve 展示报告 ...

  10. Spring框架第二天

    ## Spring框架第二天 ## ---------- **课程回顾:Spring框架第一天** 1. 概述 * IOC和AOP 2. 框架的IOC的入门 * 创建applicationContex ...