/ 设置 10 秒超时 // 每日统计清 0 runtime_set('todaycomments', 0); runtime_set('todayarticles', 0); runtime_set('todayusers', 0); if ($forumlist) { $fidarr = array(); foreach ($forumlist as $fid => $forum) { $fidarr[] = $forum['fid']; } forum_update($fidarr, array('todayposts' => 0, 'todaythreads' => 0)); } // 清理临时附件 attach_gc(); // 当天24点 $today = strtotime(date('Ymd')) + 86400; runtime_set('cron_2_last_date', $today, TRUE); // 往前推8个小时,尽量保证在前一天 升级过来和采集的数据会很卡 // table_day_cron($time - 8 * 3600); cache_delete('cron_lock_2'); } } } ?>javascript - Load from $http.get on accordion-group open using AngularJS - Stack Overflow|Concepts Of Algorithm

javascript - Load from $http.get on accordion-group open using AngularJS - Stack Overflow

admin2025-04-17  2

I'm using Angular v1.2.0rc1 and Angular-UI Bootstrap.

[edit] What I want is a load-on-demand with cache while using an accordeon.

I'm using an accordion group from here. With some backend requeriments: I would like to load the contents for inside of the accordion only when the accordion is opened (clicked).

Then, I want that response be cached so you can open/close as many as you want and not overload the server.

I tried using ng-click on the heading but it gets override via the AngularUI Bootstrap.

Is there a way to solve this?

I'm using Angular v1.2.0rc1 and Angular-UI Bootstrap.

[edit] What I want is a load-on-demand with cache while using an accordeon.

I'm using an accordion group from here. With some backend requeriments: I would like to load the contents for inside of the accordion only when the accordion is opened (clicked).

Then, I want that response be cached so you can open/close as many as you want and not overload the server.

I tried using ng-click on the heading but it gets override via the AngularUI Bootstrap.

Is there a way to solve this?

Share edited Oct 8, 2013 at 18:24 genuinefafa asked Oct 8, 2013 at 14:57 genuinefafagenuinefafa 7131 gold badge6 silver badges21 bronze badges 2
  • Are you taking about loading html content of tab on demand? – Chandermani Commented Oct 8, 2013 at 15:25
  • yes, that's what i want load on demand while using an accordeon! :) (i just add that ment in the description of the question) – genuinefafa Commented Oct 8, 2013 at 18:19
Add a ment  | 

1 Answer 1

Reset to default 7

You can use the accordion heading tag to catch the ng-click

<div accordion ng-controller="AccordionCtrl">
  <div accordion-group ng-repeat="group in groups">
    <div accordion-heading >
      <div ng-click='loadGroup(group)'>
        {{group.title}}        
      </div>
    </div>
    {{group.loaded}}
  </div>
</div>  

with this controllers

var AccordionMenuCtrl = ['$scope', '$http' function ($scope, $http) {
  $scope.groups = [
    {
      url: 'http://whatever',
      title: 'whatever'
    },
    {
      url: 'http://whatever_else',
      title: 'whatever else'
    }
  ]

  $scope.loadGroup = function (group) {
    $http.get(group.url).success(function (data) {
      group.loaded = data
    });
  }
}];
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1744857673a270925.html

最新回复(0)