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://codercto.com/soft/d/1538.html

《数据结构》算法实现及解析

《数据结构》算法实现及解析

高一凡 / 西安电子科技大学出版社 / 2002-10-1 / 35.0

《数据结构算法实现及解析》配有光盘,光盘中包括书中所有程序及用标准C语言改写的程序。所有程序均在计算机上运行通过。《数据结构算法实现及解析》适用于使用教科书的大中专学生和自学者。书中的基本操作函数也可供从事计算机工程与应用工作的科技人员参考和采用。一起来看看 《《数据结构》算法实现及解析》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

MD5 加密
MD5 加密

MD5 加密工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具