• 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;}

    }])

  • 相关阅读:
    MIPS笔记
    花生壳动态域名解析工具原理
    SEE MIPS RUN 第六章 内存管理与TLB
    C/C++动态内存创建与内存管理
    ngclass 用法
    看了一个烟花的html作品 引用:http://www.w3cfuns.com/blog54440495404365.html
    ngclip angualr 的copy功能
    学习技术的方法
    restful restAPI 的定义方式
    我与计算机
  • 原文地址:https://www.cnblogs.com/peiyao/p/7269725.html
Copyright © 2020-2023  润新知