码迷,mamicode.com
首页 > 移动开发 > 详细

angular --- s3core移动端项目(二)

时间:2017-08-01 19:07:08      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:eve   core   ted   rod   etc   rom   sts   each   second   

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移动端项目(二)

标签:eve   core   ted   rod   etc   rom   sts   each   second   

原文地址:http://www.cnblogs.com/peiyao/p/7269725.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!