zoukankan      html  css  js  c++  java
  • 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;}

    }])

  • 相关阅读:
    死锁
    Notepad++源代码阅读——窗口封装与继承
    Notepad++源代码阅读——窗口元素组织与布局
    选择问题(selection problem)
    插入排序 | 冒泡排序 | 希尔排序 | 堆排序 | 快速排序 | 选择排序 | 归并排序
    编程之美2014---大神与三位小伙伴
    ulimit 修改 open files & core
    tmux手记
    匿名访问windows server 2008 R2 文件服务器的共享
    WINDOWS系统变量
  • 原文地址:https://www.cnblogs.com/peiyao/p/7269725.html
Copyright © 2011-2022 走看看