1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        angular-dataAngularJS 數(shù)據(jù)存儲(chǔ)/緩存擴(kuò)展

        聯(lián)合創(chuàng)作 · 2023-09-19 13:39

        angular-data 是 AngularJS 的一個(gè)擴(kuò)展,實(shí)現(xiàn)了數(shù)據(jù)存儲(chǔ)和緩存的功能。

        示例代碼:

        var app = angular.module('myApp', ['angular-data.DS']);
        app.factory('User', function (DS) {
          // Simplest resource definition
          return DS.defineResource('user');
        });
        app.controller('friendsCtrl', function ($scope, $routeParams, User) {
          // it's up to your server to know how to interpret this query
          // or you can teach angular-data how to understand your servers' query language
          var query = {
            where: {
              friendIds: {
                in: $routeParams.id
              }
            }
          };
          
          User.find($routeParams.id);
          User.findAll(query);
          
          // My goodness this was easy
          User.bindOne($scope, 'me', $routeParams.id);
          User.bindAll($scope, 'friends', query);
          
          // Long form
          $scope.$watch(function () {
            return User.lastModified($routeParams.id);
          }, function () {
            $scope.me = User.get($routeParams.id);
          });
          $scope.$watch(function () {
            // Changes when anything in the User collection is modified
            return User.lastModified();
          }, function () {
            $scope.friends = User.filter(query);
          });
        });
        瀏覽 20
        點(diǎn)贊
        評(píng)論
        收藏
        分享

        手機(jī)掃一掃分享

        編輯 分享
        舉報(bào)
        評(píng)論
        圖片
        表情
        推薦
        點(diǎn)贊
        評(píng)論
        收藏
        分享

        手機(jī)掃一掃分享

        編輯 分享
        舉報(bào)
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            超碰免费电影 | 亚洲sese | 日韩二区在线 | 色天天综合久久久久综合片 | www.大香蕉伊人.com | 亚洲黑逼 | 国产艹b视频 | 欧美精品三级 | 五月天激情小说 | 91精品国自产在线观看 |