小编Ale*_*lex的帖子

Angularjs:如何在返回时恢复到上一个​​视图中运行时加载的DOM元素(保留状态)

我有一个有角度的应用程序有两个视图:

1)列表视图

2)细节视图

当您从列表视图中单击缩略图时,您将转到详细视图,这是路径:

app.config(['$routeProvider',
  function($routeProvider) {
    $routeProvider.
      when('/list', {
        templateUrl: 'partials/list.html',
        controller: 'ListCtrl',

      }).
      when('/list/:id', {
        templateUrl: 'partials/detail.html',
        controller: 'DetailCtrl',

      }).
      otherwise({
        redirectTo: '/list'
      });
  }]);
Run Code Online (Sandbox Code Playgroud)

现在在'listCtrl'控制器中有一个函数loadmore用于加载

myControllers.controller('ListCtrl', ['$scope', '$location', 'Troll', '$http',

function ($scope, $location, Troll, $http) {
    $scope.Trolls = Troll.query();
    $scope.orderProp = 'popular';
    $scope.fromData = {};
    //console.log($scope.Trolls);
    //this will be used to fetch the data in json which is defined in services.js

    $scope.loadmore = function () {
        jQuery.ajax({
            url: 'trolls/trolls.php?troll_index=' + $('#main-content #item-list .sub-item').size(),
            type: 'GET',
            async: false, …
Run Code Online (Sandbox Code Playgroud)

javascript savestate angularjs

4
推荐指数
1
解决办法
1248
查看次数

标签 统计

angularjs ×1

javascript ×1

savestate ×1