angular-data

码农软件 · 软件分类 · AngularJS 扩展 · 2019-03-17 11:41:59

软件介绍

angular-data 是 AngularJS 的一个扩展,实现了数据存储和缓存的功能。

示例代码:

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);
  });
});

本文地址:https://www.codercto.com/soft/d/1538.html

深度探索C++对象模型

深度探索C++对象模型

斯坦利•B.李普曼 (Stanley B. Lippman) / 侯捷 / 电子工业出版社 / 2012-1 / 69.00元

作者Lippman参与设计了全世界第一套C++编译程序cfront,这本书就是一位伟大的C++编译程序设计者向你阐述他如何处理各种explicit(明确出现于C++程序代码中)和implicit(隐藏于程序代码背后)的C++语意。 本书专注于C++面向对象程序设计的底层机制,包括结构式语意、临时性对象的生成、封装、继承,以及虚拟——虚拟函数和虚拟继承。这本书让你知道:一旦你能够了解底层实现模......一起来看看 《深度探索C++对象模型》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具