|
1 | 1 | /**
|
2 | 2 | * @author Jason Dobry <[email protected]>
|
3 | 3 | * @file js-data-angular.js
|
4 |
| -* @version 2.2.1 - Homepage <http://www.js-data.io/js-data-angular/> |
5 |
| -* @copyright (c) 2014 Jason Dobry <https://github.com/jmdobry/> |
| 4 | +* @version 2.2.2 - Homepage <http://www.js-data.io/docs/js-data-angular/> |
| 5 | +* @copyright (c) 2014-2015 Jason Dobry <https://github.com/jmdobry/> |
6 | 6 | * @license MIT <https://github.com/js-data/js-data-angular/blob/master/LICENSE>
|
7 | 7 | *
|
8 | 8 | * @overview Angular wrapper for js-data.js.
|
9 | 9 | */
|
10 |
| -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ |
11 | 10 | /*jshint loopfunc:true*/
|
12 |
| -(function (window, angular, undefined) { |
| 11 | +(function (root, factory) { |
13 | 12 | 'use strict';
|
14 | 13 |
|
15 |
| - var JSData; |
16 |
| - |
17 |
| - try { |
18 |
| - JSData = require('js-data'); |
19 |
| - } catch (e) { |
20 |
| - |
21 |
| - } |
22 |
| - |
23 |
| - if (!JSData) { |
24 |
| - JSData = window.JSData; |
| 14 | + if (typeof define === 'function' && define.amd) { |
| 15 | + define(['angular', 'js-data'], function (angular, JSData) { |
| 16 | + return factory(root, angular, JSData, undefined); |
| 17 | + }); |
| 18 | + } else if (typeof exports === 'object' && typeof module === 'object') { |
| 19 | + module.exports = factory(root, require('angular') || root.angular, require('js-data') || root.JSData, undefined); |
| 20 | + } else if (typeof exports === 'object') { |
| 21 | + exports.jsDataAngularModuleName = factory(root, require('angular') || root.angular, require('js-data') || root.JSData, undefined); |
| 22 | + } else { |
| 23 | + root.jsDataAngularModuleName = factory(root, root.angular, root.JSData, undefined); |
25 | 24 | }
|
| 25 | +}(this, function (window, angular, JSData, undefined) { |
| 26 | + 'use strict'; |
26 | 27 |
|
27 |
| - if (!JSData) { |
28 |
| - throw new Error('js-data must be loaded!'); |
| 28 | + if (!JSData || !angular) { |
| 29 | + throw new Error('js-data and angular must be loaded!'); |
29 | 30 | }
|
30 | 31 |
|
31 | 32 | var DSUtils = JSData.DSUtils;
|
|
358 | 359 | var _this = this;
|
359 | 360 | options = options || {};
|
360 | 361 | options.suffix = options.suffix || resourceConfig.suffix;
|
| 362 | + options.params = options.params || {}; |
| 363 | + options.params = _this.defaults.queryTransform(resourceConfig, options.params); |
361 | 364 | return _this.GET(
|
362 | 365 | _this.getPath('find', resourceConfig, id, options),
|
363 | 366 | options
|
|
393 | 396 | var _this = this;
|
394 | 397 | options = options || {};
|
395 | 398 | options.suffix = options.suffix || resourceConfig.suffix;
|
| 399 | + options.params = options.params || {}; |
| 400 | + options.params = _this.defaults.queryTransform(resourceConfig, options.params); |
396 | 401 | return _this.POST(
|
397 | 402 | _this.getPath('create', resourceConfig, attrs, options),
|
398 | 403 | (options.serialize ? options.serialize : _this.defaults.serialize)(resourceConfig, attrs),
|
|
406 | 411 | var _this = this;
|
407 | 412 | options = options || {};
|
408 | 413 | options.suffix = options.suffix || resourceConfig.suffix;
|
| 414 | + options.params = options.params || {}; |
| 415 | + options.params = _this.defaults.queryTransform(resourceConfig, options.params); |
409 | 416 | return _this.PUT(
|
410 | 417 | _this.getPath('update', resourceConfig, id, options),
|
411 | 418 | (options.serialize ? options.serialize : _this.defaults.serialize)(resourceConfig, attrs),
|
|
438 | 445 | var _this = this;
|
439 | 446 | options = options || {};
|
440 | 447 | options.suffix = options.suffix || resourceConfig.suffix;
|
| 448 | + options.params = options.params || {}; |
| 449 | + options.params = _this.defaults.queryTransform(resourceConfig, options.params); |
441 | 450 | return _this.DEL(
|
442 | 451 | _this.getPath('destroy', resourceConfig, id, options),
|
443 | 452 | options
|
|
472 | 481 | var _this = this;
|
473 | 482 | var start = new Date();
|
474 | 483 | config = deepMixIn(config, _this.defaults.httpConfig);
|
475 |
| - if (_this.defaults.forceTrailingSlash && config.url[config.url.length-1] !== '/') { |
| 484 | + if (_this.defaults.forceTrailingSlash && config.url[config.url.length - 1] !== '/') { |
476 | 485 | config.url += '/';
|
477 | 486 | }
|
478 | 487 | config.method = config.method.toUpperCase();
|
|
513 | 522 | }]);
|
514 | 523 | }
|
515 | 524 |
|
516 |
| -})(window, window.angular); |
517 |
| - |
518 |
| -},{"js-data":"js-data"}]},{},[1]); |
| 525 | + // return the module name |
| 526 | + return 'js-data'; |
| 527 | +})); |
0 commit comments