Skip to content

Commit

Permalink
new build
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Miller committed Apr 25, 2014
1 parent 695464d commit 51af01b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
35 changes: 26 additions & 9 deletions dist/ng-active-resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,16 @@ angular.module('ActiveResource').provider('ARCache', function () {
return !!!Object.keys(this).length;
}
});
// function length()
//
// Length of cache, since cache is object so it has no length
// property by default
Object.defineProperty(this, 'length', {
enumerable: false,
value: function () {
return Object.keys(this).length;
}
});
// function where(terms)
//
// @param {terms} - Search terms used to find instances in the cache
Expand Down Expand Up @@ -1050,13 +1060,6 @@ angular.module('ActiveResource').provider('ARMixin', function () {
giver = new giver();
}
for (var i in giver) {
if (excludeFunctions) {
if (typeof giver[i] !== 'function') {
mixinProp();
}
} else {
mixinProp();
}
function mixinProp() {
if (!receiver.hasOwnProperty(i)) {
(function () {
Expand All @@ -1074,6 +1077,13 @@ angular.module('ActiveResource').provider('ARMixin', function () {
receiver[i] = giver[i];
}
}
if (excludeFunctions) {
if (typeof giver[i] !== 'function') {
mixinProp();
}
} else {
mixinProp();
}
}
return receiver;
};
Expand Down Expand Up @@ -1163,7 +1173,8 @@ angular.module('ActiveResource').provider('ARGET', function () {
'ARAssociations',
'ARHelpers',
'URLify',
function ($http, deferred, Associations, Helpers, URLify) {
'$q',
function ($http, deferred, Associations, Helpers, URLify, $q) {
function resolveSingleGET(data, terms, options) {
if (data && data.length >= 1) {
if (options.noInstanceEndpoint)
Expand Down Expand Up @@ -1242,6 +1253,11 @@ angular.module('ActiveResource').provider('ARGET', function () {
url = url.replace(/\/\:[a-zA-Z_]+/g, '').replace(/\:[a-zA-Z_]+/g, '');
config.params = terms;
}
if (options.api === false) {
var deferred = $q.defer();
deferred.resolve(options.cached);
return deferred.promise;
}
return $http.get(url, config).then(function (response) {
var data = response.data;
if (propertyName && associatedInstance) {
Expand Down Expand Up @@ -1681,7 +1697,8 @@ angular.module('ActiveResource').provider('ARBase', function () {
if (!options)
options = {
lazy: false,
overEager: false
overEager: false,
api: true
};
var cached = _this.cached.where(terms);
options.cached = cached;
Expand Down

0 comments on commit 51af01b

Please sign in to comment.