5-4 公司详情页controller完善(2)加入--$scope.showPositionList(0);--会报错,怎么给 $scope.com赋值?

来源:5-4 公司详情页controller完善(2)

女神☆经病

2017-02-15

问题补充(选填):请详细描述

http://szimg.mukewang.com/58a40fff00011c5010840418.jpg

http://szimg.mukewang.com/58a40fc600017d3810850425.jpg

58a40e7500010a4805000174.jpg

58a40e750001179305000199.jpg



58a40e750001b54105000423.jpg

58a40e76000181d605000341.jpg

58a40e760001dac605000190.jpg

你的问题,贴出相关代码或截图,并告知你的操作步骤

写回答

1回答

女神☆经病

提问者

2017-02-15

 上述问题已解决

link:function($scope){

   

      $scope.showPositionList=function(idx){

    $scope.positionList = $scope.com.positionClass[idx].positionList;

    $scope.isActive = idx;

  }

  $scope.$watch('com',function(newVal){

  if(newVal) $scope.showPositionList(0);

  });

   }

};


1
1
weibo_我看你是饿得慌_03361000
感谢!我也是这个问题,你这个解决了,我就没想到用watch服务。。
2017-03-28
共1条回复

Angular JS 仿拉勾网 WebApp 开发移动端单页应用

基于AngularJS,仿拉勾网开发一个招聘类的移动端单页应用

1660 学习 · 857 问题

查看课程