diff --git a/bundle.js b/bundle.js
new file mode 100644
index 000000000..e69de29bb
diff --git a/dist/.index.js.swp b/dist/.index.js.swp
deleted file mode 100644
index 46c5161e0..000000000
Binary files a/dist/.index.js.swp and /dev/null differ
diff --git a/dist/index.js b/dist/index.js
index 71bfcfd2f..ad2153308 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1,6 +1,8 @@
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
+var ng1_1 = require('./ng1');
+ng1_1.initAngular1();
var DEVICE_READY_TIMEOUT = 2000;
__export(require('./plugins/actionsheet'));
__export(require('./plugins/ble'));
@@ -12,6 +14,31 @@ __export(require('./plugins/facebook'));
__export(require('./plugins/geolocation'));
__export(require('./plugins/statusbar'));
__export(require('./plugins/toast'));
+var actionsheet_2 = require('./plugins/actionsheet');
+var ble_2 = require('./plugins/ble');
+var camera_2 = require('./plugins/camera');
+var calendar_2 = require('./plugins/calendar');
+var device_2 = require('./plugins/device');
+var facebook_2 = require('./plugins/facebook');
+var geolocation_2 = require('./plugins/geolocation');
+var statusbar_2 = require('./plugins/statusbar');
+var toast_2 = require('./plugins/toast');
+// Window export to use outside of a module loading system
+window['IonicNative'] = {
+ ActionSheet: actionsheet_2.ActionSheet,
+ BLE: ble_2.BLE,
+ Camera: camera_2.Camera,
+ Calendar: calendar_2.Calendar,
+ Device: device_2.Device,
+ Facebook: facebook_2.Facebook,
+ Geolocation: geolocation_2.Geolocation,
+ StatusBar: statusbar_2.StatusBar,
+ Toast: toast_2.Toast
+};
+// To help developers using cordova, we listen for the device ready event and
+// log an error if it didn't fire in a reasonable amount of time. Generally,
+// when this happens, developers should remove and reinstall plugins, since
+// an inconsistent plugin is often the culprit.
var before = +new Date;
var didFireReady = false;
document.addEventListener('deviceready', function () {
diff --git a/dist/index.js.map b/dist/index.js.map
index 0a7b8280b..8ef402525 100644
--- a/dist/index.js.map
+++ b/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,IAAM,oBAAoB,GAAG,IAAI,CAAC;AAElC,iBAAc,uBAAuB,CAAC,EAAA;AACtC,iBAAc,eAAe,CAAC,EAAA;AAC9B,iBAAc,kBAAkB,CAAC,EAAA;AACjC,iBAAc,oBAAoB,CAAC,EAAA;AACnC,iBAAc,oBAAoB,CAAC,EAAA;AACnC,iBAAc,kBAAkB,CAAC,EAAA;AACjC,iBAAc,oBAAoB,CAAC,EAAA;AACnC,iBAAc,uBAAuB,CAAC,EAAA;AACtC,iBAAc,qBAAqB,CAAC,EAAA;AACpC,iBAAc,iBAAiB,CAAC,EAAA;AAShC,IAAI,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC;AAEvB,IAAI,YAAY,GAAG,KAAK,CAAC;AACzB,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE;IACvC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,CAAC,CAAC,IAAI,IAAI,GAAG,MAAM,CAAC,EAAE,IAAI,CAAC,CAAA;IACnE,YAAY,GAAG,IAAI,CAAC;AACtB,CAAC,CAAC,CAAA;AAEF,UAAU,CAAC;IACT,EAAE,CAAA,CAAC,CAAC,YAAY,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QACnC,OAAO,CAAC,IAAI,CAAC,0CAA0C,GAAG,oBAAoB,GAAG,0HAA0H,CAAC,CAAC;IAC/M,CAAC;AACH,CAAC,EAAE,oBAAoB,CAAC,CAAC"}
\ No newline at end of file
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,oBAA2B,OAAO,CAAC,CAAA;AACnC,kBAAY,EAAE,CAAC;AAEf,IAAM,oBAAoB,GAAG,IAAI,CAAC;AAGlC,iBAAc,uBAAuB,CAAC,EAAA;AACtC,iBAAc,eAAe,CAAC,EAAA;AAC9B,iBAAc,kBAAkB,CAAC,EAAA;AACjC,iBAAc,oBAAoB,CA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MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QACnC,OAAO,CAAC,IAAI,CAAC,0CAA0C,GAAG,oBAAoB,GAAG,0HAA0H,CAAC,CAAC;IAC/M,CAAC;AACH,CAAC,EAAE,oBAAoB,CAAC,CAAC"}
\ No newline at end of file
diff --git a/dist/ionic.native.d.ts b/dist/ionic.native.d.ts
new file mode 100644
index 000000000..e69de29bb
diff --git a/dist/ionic.native.js b/dist/ionic.native.js
new file mode 100644
index 000000000..73c245c34
--- /dev/null
+++ b/dist/ionic.native.js
@@ -0,0 +1 @@
+//# sourceMappingURL=ionic.native.js.map
\ No newline at end of file
diff --git a/dist/ionic.native.js.map b/dist/ionic.native.js.map
new file mode 100644
index 000000000..ed0487d77
--- /dev/null
+++ b/dist/ionic.native.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"ionic.native.js","sourceRoot":"","sources":[],"names":[],"mappings":""}
\ No newline at end of file
diff --git a/dist/ng1.d.ts b/dist/ng1.d.ts
new file mode 100644
index 000000000..ffb86be5d
--- /dev/null
+++ b/dist/ng1.d.ts
@@ -0,0 +1,8 @@
+/**
+ * Initialize the ngCordova Angular module if we're running in ng1
+ */
+export declare function initAngular1(): void;
+/**
+ * Publish a new Angular 1 service for this plugin.
+ */
+export declare function publishAngular1Service(config: any, cls: any): void;
diff --git a/dist/ng1.js b/dist/ng1.js
new file mode 100644
index 000000000..08fe58111
--- /dev/null
+++ b/dist/ng1.js
@@ -0,0 +1,24 @@
+/**
+ * Initialize the ngCordova Angular module if we're running in ng1
+ */
+function initAngular1() {
+ if (window.angular) {
+ window.angular.module('ngCordova', []);
+ }
+}
+exports.initAngular1 = initAngular1;
+/**
+ * Publish a new Angular 1 service for this plugin.
+ */
+function publishAngular1Service(config, cls) {
+ var serviceName = '$cordova' + cls.name;
+ console.log('Registering Angular1 service', serviceName);
+ window.angular.module('ngCordova').service(serviceName, [function () {
+ var funcs = {};
+ for (var k in cls) {
+ }
+ return funcs;
+ }]);
+}
+exports.publishAngular1Service = publishAngular1Service;
+//# sourceMappingURL=ng1.js.map
\ No newline at end of file
diff --git a/dist/ng1.js.map b/dist/ng1.js.map
new file mode 100644
index 000000000..e26f61a2f
--- /dev/null
+++ b/dist/ng1.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"ng1.js","sourceRoot":"","sources":["../src/ng1.ts"],"names":["initAngular1","publishAngular1Service"],"mappings":"AAEA;;GAEG;AACH;IACEA,EAAEA,CAAAA,CAACA,MAAMA,CAACA,OAAOA,CAACA,CAACA,CAACA;QAClBA,MAAMA,CAACA,OAAOA,CAACA,MAAMA,CAACA,WAAWA,EAAEA,EAAEA,CAACA,CAACA;IACzCA,CAACA;AACHA,CAACA;AAJe,oBAAY,eAI3B,CAAA;AAED;;GAEG;AACH,gCAAuC,MAAU,EAAE,GAAO;IACxDC,IAAIA,WAAWA,GAAGA,UAAUA,GAAGA,GAAGA,CAACA,IAAIA,CAACA;IACxCA,OAAOA,CAACA,GAAGA,CAACA,8BAA8BA,EAAEA,WAAWA,CAACA,CAACA;IACzDA,MAAMA,CAACA,OAAOA,CAACA,MAAMA,CAACA,WAAWA,CAACA,CAACA,OAAOA,CAACA,WAAWA,EAAEA,CAACA;YACvD,IAAI,KAAK,GAAG,EAAE,CAAC;YACf,GAAG,CAAA,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;YACnB,CAAC;YACD,MAAM,CAAC,KAAK,CAAC;QACf,CAAC,CAACA,CAACA,CAACA;AACNA,CAACA;AATe,8BAAsB,yBASrC,CAAA"}
\ No newline at end of file
diff --git a/dist/plugins/actionsheet.js b/dist/plugins/actionsheet.js
index d638c1299..c43da84ab 100644
--- a/dist/plugins/actionsheet.js
+++ b/dist/plugins/actionsheet.js
@@ -1,8 +1,10 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
+ case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
+ case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
+ }
};
var plugin_1 = require('./plugin');
var ActionSheet = (function () {
@@ -12,12 +14,14 @@ var ActionSheet = (function () {
;
ActionSheet.hide = function (options) { };
;
- __decorate([
- plugin_1.Cordova()
- ], ActionSheet, "show", null);
- __decorate([
- plugin_1.Cordova()
- ], ActionSheet, "hide", null);
+ Object.defineProperty(ActionSheet, "show",
+ __decorate([
+ plugin_1.Cordova()
+ ], ActionSheet, "show", Object.getOwnPropertyDescriptor(ActionSheet, "show")));
+ Object.defineProperty(ActionSheet, "hide",
+ __decorate([
+ plugin_1.Cordova()
+ ], ActionSheet, "hide", Object.getOwnPropertyDescriptor(ActionSheet, "hide")));
ActionSheet = __decorate([
plugin_1.Plugin({
name: 'ActionSheet',
diff --git a/dist/plugins/actionsheet.js.map b/dist/plugins/actionsheet.js.map
index 977554008..4b6117209 100644
--- a/dist/plugins/actionsheet.js.map
+++ b/dist/plugins/actionsheet.js.map
@@ -1 +1 @@
-{"version":3,"file":"actionsheet.js","sourceRoot":"","sources":["../../src/plugins/actionsheet.ts"],"names":["ActionSheet","ActionSheet.constructor","ActionSheet.show","ActionSheet.hide"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IAYAC,CAACA;IAJQD,gBAAIA,GADXA,UACYA,OAAWA,IAAEE,CAACA;;IAGnBF,gBAAIA,GADXA,UACYA,OAAWA,IAAEG,CAACA;;IAJ1BH;QAACA,gBAAOA,EAAEA;OACHA,mBAAIA,QAAeA;IAE1BA;QAACA,gBAAOA,EAAEA;OACHA,mBAAIA,QAAeA;IAX5BA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,aAAaA;YACnBA,MAAMA,EAAEA,4BAA4BA;YACpCA,SAASA,EAAEA,qBAAqBA;YAChCA,IAAIA,EAAEA,8DAA8DA;SACrEA,CAACA;oBAODA;IAADA,kBAACA;AAADA,CAACA,AAZD,IAYC;AANY,mBAAW,cAMvB,CAAA"}
\ No newline at end of file
+{"version":3,"file":"actionsheet.js","sourceRoot":"","sources":["../../src/plugins/actionsheet.ts"],"names":["ActionSheet","ActionSheet.constructor","ActionSheet.show","ActionSheet.hide"],"mappings":";;;;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IAYAC,CAACA;IAJQD,gBAAIA,GADXA,UACYA,OAAWA,IAAEE,CAACA;;IAGnBF,gBAAIA,GADXA,UACYA,OAAWA,IAAEG,CAACA;;IAJ1BH,sBACOA,mBAAIA;;YADVA,gBAAOA,EAAEA;WACHA,mBAAIA,kCAAJA,mBAAIA,IAAeA;IAE1BA,sBACOA,mBAAIA;;YADVA,gBAAOA,EAAEA;WACHA,mBAAIA,kCAAJA,mBAAIA,IAAeA;IAX5BA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,aAAaA;YACnBA,MAAMA,EAAEA,4BAA4BA;YACpCA,SAASA,EAAEA,qBAAqBA;YAChCA,IAAIA,EAAEA,8DAA8DA;SACrEA,CAACA;oBAODA;IAADA,kBAACA;AAADA,CAACA,AAZD,IAYC;AANY,mBAAW,cAMvB,CAAA"}
\ No newline at end of file
diff --git a/dist/plugins/ble.js b/dist/plugins/ble.js
index ea61ab6a7..4c04d745d 100644
--- a/dist/plugins/ble.js
+++ b/dist/plugins/ble.js
@@ -1,8 +1,10 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
+ case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
+ case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
+ }
};
var plugin_1 = require('./plugin');
var BLE = (function () {
@@ -23,30 +25,38 @@ var BLE = (function () {
;
BLE.writeWithoutResponse = function (deviceId, serviceUUID, characteristicUUID, value) { };
;
- __decorate([
- plugin_1.Cordova()
- ], BLE, "scan", null);
- __decorate([
- plugin_1.Cordova()
- ], BLE, "startScan", null);
- __decorate([
- plugin_1.Cordova()
- ], BLE, "stopScan", null);
- __decorate([
- plugin_1.Cordova()
- ], BLE, "connect", null);
- __decorate([
- plugin_1.Cordova()
- ], BLE, "disconnect", null);
- __decorate([
- plugin_1.Cordova()
- ], BLE, "read", null);
- __decorate([
- plugin_1.Cordova()
- ], BLE, "write", null);
- __decorate([
- plugin_1.Cordova()
- ], BLE, "writeWithoutResponse", null);
+ Object.defineProperty(BLE, "scan",
+ __decorate([
+ plugin_1.Cordova()
+ ], BLE, "scan", Object.getOwnPropertyDescriptor(BLE, "scan")));
+ Object.defineProperty(BLE, "startScan",
+ __decorate([
+ plugin_1.Cordova()
+ ], BLE, "startScan", Object.getOwnPropertyDescriptor(BLE, "startScan")));
+ Object.defineProperty(BLE, "stopScan",
+ __decorate([
+ plugin_1.Cordova()
+ ], BLE, "stopScan", Object.getOwnPropertyDescriptor(BLE, "stopScan")));
+ Object.defineProperty(BLE, "connect",
+ __decorate([
+ plugin_1.Cordova()
+ ], BLE, "connect", Object.getOwnPropertyDescriptor(BLE, "connect")));
+ Object.defineProperty(BLE, "disconnect",
+ __decorate([
+ plugin_1.Cordova()
+ ], BLE, "disconnect", Object.getOwnPropertyDescriptor(BLE, "disconnect")));
+ Object.defineProperty(BLE, "read",
+ __decorate([
+ plugin_1.Cordova()
+ ], BLE, "read", Object.getOwnPropertyDescriptor(BLE, "read")));
+ Object.defineProperty(BLE, "write",
+ __decorate([
+ plugin_1.Cordova()
+ ], BLE, "write", Object.getOwnPropertyDescriptor(BLE, "write")));
+ Object.defineProperty(BLE, "writeWithoutResponse",
+ __decorate([
+ plugin_1.Cordova()
+ ], BLE, "writeWithoutResponse", Object.getOwnPropertyDescriptor(BLE, "writeWithoutResponse")));
BLE = __decorate([
plugin_1.Plugin({
name: 'BluetoothLowEnergy',
diff --git a/dist/plugins/ble.js.map b/dist/plugins/ble.js.map
index 402fe4816..ed0cebce6 100644
--- a/dist/plugins/ble.js.map
+++ b/dist/plugins/ble.js.map
@@ -1 +1 @@
-{"version":3,"file":"ble.js","sourceRoot":"","sources":["../../src/plugins/ble.ts"],"names":["BLE","BLE.constructor","BLE.scan","BLE.startScan","BLE.stopScan","BLE.connect","BLE.disconnect","BLE.read","BLE.write","BLE.writeWithoutResponse"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IA8BAC,CAACA;IAtBQD,QAAIA,GADXA,UACYA,QAAcA,EAAEA,OAAcA,IAAGE,CAACA;IAGvCF,aAASA,GADhBA,UACiBA,QAAcA,IAAEG,CAACA;;IAG3BH,YAAQA,GADfA,cACkBI,CAACA;;IAGZJ,WAAOA,GADdA,UACeA,QAAeA,IAAEK,CAACA;;IAG1BL,cAAUA,GADjBA,UACkBA,QAAeA,IAAEM,CAACA;;IAG7BN,QAAIA,GADXA,UACYA,QAAeA,EAAEA,WAAkBA,EAAEA,kBAAyBA,IAAEO,CAACA;;IAGtEP,SAAKA,GADZA,UACaA,QAAeA,EAAEA,WAAkBA,EAAEA,kBAAyBA,EAAEA,KAAiBA,IAAEQ,CAACA;;IAG1FR,wBAAoBA,GAD3BA,UAC4BA,QAAeA,EAAEA,WAAkBA,EAAEA,kBAAyBA,EAAEA,KAAiBA,IAAES,CAACA;;IAtBhHT;QAACA,gBAAOA,EAAEA;OACHA,WAAIA,QAAmCA;IAE9CA;QAACA,gBAAOA,EAAEA;OACHA,gBAASA,QAAkBA;IAElCA;QAACA,gBAAOA,EAAEA;OACHA,eAAQA,QAAIA;IAEnBA;QAACA,gBAAOA,EAAEA;OACHA,cAAOA,QAAmBA;IAEjCA;QAACA,gBAAOA,EAAEA;OACHA,iBAAUA,QAAmBA;IAEpCA;QAACA,gBAAOA,EAAEA;OACHA,WAAIA,QAAkEA;IAE7EA;QAACA,gBAAOA,EAAEA;OACHA,YAAKA,QAAqFA;IAEjGA;QAACA,gBAAOA,EAAEA;OACHA,2BAAoBA,QAAqFA;IA7BlHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,oBAAoBA;YAC1BA,MAAMA,EAAEA,4BAA4BA;YACpCA,SAASA,EAAEA,KAAKA;YAChBA,UAAUA,EAAEA,mDAAmDA;SAChEA,CAACA;YAyBDA;IAADA,UAACA;AAADA,CAACA,AA9BD,IA8BC;AAxBY,WAAG,MAwBf,CAAA"}
\ No newline at end of file
+{"version":3,"file":"ble.js","sourceRoot":"","sources":["../../src/plugins/ble.ts"],"names":["BLE","BLE.constructor","BLE.scan","BLE.startScan","BLE.stopScan","BLE.connect","BLE.disconnect","BLE.read","BLE.write","BLE.writeWithoutResponse"],"mappings":";;;;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IA8BAC,CAACA;IAtBQD,QAAIA,GADXA,UACYA,QAAcA,EAAEA,OAAcA,IAAGE,CAACA;IA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A;YACpCA,SAASA,EAAEA,KAAKA;YAChBA,UAAUA,EAAEA,mDAAmDA;SAChEA,CAACA;YAyBDA;IAADA,UAACA;AAADA,CAACA,AA9BD,IA8BC;AAxBY,WAAG,MAwBf,CAAA"}
\ No newline at end of file
diff --git a/dist/plugins/calendar.js b/dist/plugins/calendar.js
index 877f767fd..0a45a55e4 100644
--- a/dist/plugins/calendar.js
+++ b/dist/plugins/calendar.js
@@ -1,8 +1,10 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
+ case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
+ case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
+ }
};
var plugin_1 = require('./plugin');
var Calendar = (function () {
@@ -25,57 +27,74 @@ var Calendar = (function () {
Calendar.deleteEvent = function (title, location, notes, startDate, endDate) { };
Calendar.deleteEventFromNamedCalendar = function (title, location, notes, startDate, endDate, calendarName) { };
Calendar.openCalendar = function (date) { };
- __decorate([
- plugin_1.Cordova()
- ], Calendar, "createCalendar", null);
- __decorate([
- plugin_1.Cordova()
- ], Calendar, "deleteCalendar", null);
- __decorate([
- plugin_1.Cordova()
- ], Calendar, "getCalendarOptions", null);
- __decorate([
- plugin_1.Cordova()
- ], Calendar, "createEvent", null);
- __decorate([
- plugin_1.Cordova()
- ], Calendar, "createEventWithOptions", null);
- __decorate([
- plugin_1.Cordova()
- ], Calendar, "createEventInteractively", null);
- __decorate([
- plugin_1.Cordova()
- ], Calendar, "createEventInteractivelyWithOptions", null);
- __decorate([
- plugin_1.Cordova()
- ], Calendar, "createEventInNamedCalendar", null);
- __decorate([
- plugin_1.Cordova()
- ], Calendar, "findEvent", null);
- __decorate([
- plugin_1.Cordova()
- ], Calendar, "listEventsInRange", null);
- __decorate([
- plugin_1.Cordova()
- ], Calendar, "listCalendars", null);
- __decorate([
- plugin_1.Cordova()
- ], Calendar, "findAllEventsInNamedCalendar", null);
- __decorate([
- plugin_1.Cordova()
- ], Calendar, "modifyEvent", null);
- __decorate([
- plugin_1.Cordova()
- ], Calendar, "modifyEventWithOptions", null);
- __decorate([
- plugin_1.Cordova()
- ], Calendar, "deleteEvent", null);
- __decorate([
- plugin_1.Cordova()
- ], Calendar, "deleteEventFromNamedCalendar", null);
- __decorate([
- plugin_1.Cordova()
- ], Calendar, "openCalendar", null);
+ Object.defineProperty(Calendar, "createCalendar",
+ __decorate([
+ plugin_1.Cordova()
+ ], Calendar, "createCalendar", Object.getOwnPropertyDescriptor(Calendar, "createCalendar")));
+ Object.defineProperty(Calendar, "deleteCalendar",
+ __decorate([
+ plugin_1.Cordova()
+ ], Calendar, "deleteCalendar", Object.getOwnPropertyDescriptor(Calendar, "deleteCalendar")));
+ Object.defineProperty(Calendar, "getCalendarOptions",
+ __decorate([
+ plugin_1.Cordova()
+ ], Calendar, "getCalendarOptions", Object.getOwnPropertyDescriptor(Calendar, "getCalendarOptions")));
+ Object.defineProperty(Calendar, "createEvent",
+ __decorate([
+ plugin_1.Cordova()
+ ], Calendar, "createEvent", Object.getOwnPropertyDescriptor(Calendar, "createEvent")));
+ Object.defineProperty(Calendar, "createEventWithOptions",
+ __decorate([
+ plugin_1.Cordova()
+ ], Calendar, "createEventWithOptions", Object.getOwnPropertyDescriptor(Calendar, "createEventWithOptions")));
+ Object.defineProperty(Calendar, "createEventInteractively",
+ __decorate([
+ plugin_1.Cordova()
+ ], Calendar, "createEventInteractively", Object.getOwnPropertyDescriptor(Calendar, "createEventInteractively")));
+ Object.defineProperty(Calendar, "createEventInteractivelyWithOptions",
+ __decorate([
+ plugin_1.Cordova()
+ ], Calendar, "createEventInteractivelyWithOptions", Object.getOwnPropertyDescriptor(Calendar, "createEventInteractivelyWithOptions")));
+ Object.defineProperty(Calendar, "createEventInNamedCalendar",
+ __decorate([
+ plugin_1.Cordova()
+ ], Calendar, "createEventInNamedCalendar", Object.getOwnPropertyDescriptor(Calendar, "createEventInNamedCalendar")));
+ Object.defineProperty(Calendar, "findEvent",
+ __decorate([
+ plugin_1.Cordova()
+ ], Calendar, "findEvent", Object.getOwnPropertyDescriptor(Calendar, "findEvent")));
+ Object.defineProperty(Calendar, "listEventsInRange",
+ __decorate([
+ plugin_1.Cordova()
+ ], Calendar, "listEventsInRange", Object.getOwnPropertyDescriptor(Calendar, "listEventsInRange")));
+ Object.defineProperty(Calendar, "listCalendars",
+ __decorate([
+ plugin_1.Cordova()
+ ], Calendar, "listCalendars", Object.getOwnPropertyDescriptor(Calendar, "listCalendars")));
+ Object.defineProperty(Calendar, "findAllEventsInNamedCalendar",
+ __decorate([
+ plugin_1.Cordova()
+ ], Calendar, "findAllEventsInNamedCalendar", Object.getOwnPropertyDescriptor(Calendar, "findAllEventsInNamedCalendar")));
+ Object.defineProperty(Calendar, "modifyEvent",
+ __decorate([
+ plugin_1.Cordova()
+ ], Calendar, "modifyEvent", Object.getOwnPropertyDescriptor(Calendar, "modifyEvent")));
+ Object.defineProperty(Calendar, "modifyEventWithOptions",
+ __decorate([
+ plugin_1.Cordova()
+ ], Calendar, "modifyEventWithOptions", Object.getOwnPropertyDescriptor(Calendar, "modifyEventWithOptions")));
+ Object.defineProperty(Calendar, "deleteEvent",
+ __decorate([
+ plugin_1.Cordova()
+ ], Calendar, "deleteEvent", Object.getOwnPropertyDescriptor(Calendar, "deleteEvent")));
+ Object.defineProperty(Calendar, "deleteEventFromNamedCalendar",
+ __decorate([
+ plugin_1.Cordova()
+ ], Calendar, "deleteEventFromNamedCalendar", Object.getOwnPropertyDescriptor(Calendar, "deleteEventFromNamedCalendar")));
+ Object.defineProperty(Calendar, "openCalendar",
+ __decorate([
+ plugin_1.Cordova()
+ ], Calendar, "openCalendar", Object.getOwnPropertyDescriptor(Calendar, "openCalendar")));
Calendar = __decorate([
plugin_1.Plugin({
name: 'Calendar',
diff --git a/dist/plugins/calendar.js.map b/dist/plugins/calendar.js.map
index abab58ee1..0d2c9d3d3 100644
--- a/dist/plugins/calendar.js.map
+++ b/dist/plugins/calendar.js.map
@@ -1 +1 @@
-{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../src/plugins/calendar.ts"],"names":["Calendar","Calendar.constructor","Calendar.createCalendar","Calendar.deleteCalendar","Calendar.getCalendarOptions","Calendar.createEvent","Calendar.createEventWithOptions","Calendar.createEventInteractively","Calendar.createEventInteractivelyWithOptions","Calendar.createEventInNamedCalendar","Calendar.findEvent","Calendar.listEventsInRange","Calendar.listCalendars","Calendar.findAllEventsInNamedCalendar","Calendar.modifyEvent","Calendar.modifyEventWithOptions","Calendar.deleteEvent","Calendar.deleteEventFromNamedCalendar","Calendar.openCalendar"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IAwDAC,CAACA;IAjDQD,uBAAcA,GADrBA,UACsBA,OAAWA,IAAGE,CAACA;IAG9BF,uBAAcA,GADrBA,UACsBA,YAAmBA,IAAGG,CAACA;IAGtCH,2BAAkBA,GADzBA,cAC6BI,CAACA;IAGvBJ,oBAAWA,GADlBA,UACmBA,KAAKA,EAAEA,QAAQA,EAAEA,KAAKA,EAAEA,SAASA,EAAEA,OAAOA,IAAGK,CAACA;IAG1DL,+BAAsBA,GAD7BA,UAC8BA,KAAKA,EAAEA,QAAQA,EAAEA,KAAKA,EAAEA,SAASA,EAAEA,OAAOA,EAAEA,OAAOA,IAAGM,CAACA;IAG9EN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CAACA;IAGzFjB,qBAAYA,GADnBA,UACoBA,IAAIA,IAAGkB,CAACA;IAjD5BlB;QAACA,gBAAOA,EAAEA;OACHA,0BAAcA,QAAgBA;IAErCA;QAACA,gBAAOA,EAAEA;OACHA,0BAAcA,QAAwBA;IAE7CA;QAACA,gBAAOA,EAAEA;OACHA,8BAAkBA,QAAKA;IAE9BA;QAACA,gBAAOA,EAAEA;OACHA,uBAAWA,QAA+CA;IAEjEA;QAACA,gBAAOA,EAAEA;OACHA,kCAAsBA,QAAwDA;IAErFA;QAACA,gBAAOA,EAAEA;OACHA,oCAAwBA,QAA+CA;IAE9EA;QAACA,gBAAOA,EAAEA;OACHA,+CAAmCA,QAAwDA;IAElGA;QAACA,gBAAOA,EAAEA;OACHA,sCAA0BA,QAA6DA;IAE9FA;QAACA,gBAAOA,EAAEA;OACHA,qBAASA,QAA+CA;IAE/DA;QAACA,gBAAOA,EAAEA;OACHA,6BAAiBA,QAA+BA;IAEvDA;QAACA,gBAAOA,EAAEA;OACHA,yBAAaA,QAAIA;IAExBA;QAACA,gBAAOA,EAAEA;OACHA,wCAA4BA,QAAwBA;IAE3DA;QAACA,gBAAOA,EAAEA;OACHA,uBAAWA,QAA0GA;IAE5HA;QAACA,gBAAOA,EAAEA;OACHA,kCAAsBA,QAAwHA;IAErJA;QAACA,gBAAOA,EAAEA;OACHA,uBAAWA,QAA+CA;IAEjEA;QAACA,gBAAOA,EAAEA;OACHA,wCAA4BA,QAA6DA;IAEhGA;QAACA,gBAAOA,EAAEA;OACHA,wBAAYA,QAASA;IAvD9BA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,UAAUA;YAChBA,MAAMA,EAAEA,yBAAyBA;YACjCA,SAASA,EAAEA,kBAAkBA;SAC9BA,CAACA;iBAoDDA;IAADA,eAACA;AAADA,CAACA,AAxDD,IAwDC;AAnDY,gBAAQ,WAmDpB,CAAA"}
\ No newline at end of file
+{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../src/plugins/calendar.ts"],"names":["Calendar","Calendar.constructor","Calendar.createCalendar","Calendar.deleteCalendar","Calendar.getCalendarOptions","Calendar.createEvent","Calendar.createEventWithOptions","Calendar.createEventInteractively","Calendar.createEventInteractivelyWithOptions","Calendar.createEventInNamedCalendar","Calendar.findEvent","Calendar.listEventsInRange","Calendar.listCalendars","Calendar.findAllEventsInNamedCalendar","Calendar.modifyEvent","Calendar.modifyEventWithOptions","Calendar.deleteEvent","Calendar.deleteEventFromNamedCalendar","Calendar.openCalendar"],"mappings":";;;;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IAwDAC,CAACA;IAjDQD,uBAAcA,GADrBA,UACsBA,OAAWA,IAAGE,CAACA;IAG9BF,uBAAcA,GADrBA,UACsBA,YAAmBA,IAAGG,CAACA;IAGtCH,2BAAkBA,GADzBA,cAC6BI,CAACA;IAGvBJ,oBAAWA,GADlBA,UACmBA,KAAKA,EAAEA,QAAQA,EAAEA,KAAKA,EAAEA,SAASA,EAAEA,OAAOA,IAAGK,CAACA;IAG1DL,+BAAsBA,GAD7BA,UAC8BA,KAAKA,EAAEA,QAAQA,EAAEA,KAAKA,EAAEA,SAASA,EAAEA,OAAOA,EAAEA,OAAOA,IAAGM,CAACA;IAG9EN,iCAAwBA,GAD/BA,UACgCA,KAAKA,EAAEA,QAAQA,EAAEA,KAAKA,EAAEA,SAASA,EAAEA,OAAOA,IAAGO,CAACA;IAGvEP,4CAAmCA,GAD1CA,UAC2CA,KAAKA,EAAEA,QAAQA,EAAEA,KAAKA,EAAEA,SAASA,EAAEA,OAAOA,EAAEA,OAAOA,IAAGQ,CAACA;IAG3FR,mCAA0BA,GADjCA,UACkCA,KAAKA,EAAEA,QAAQA,EAAEA,KAAKA,EAAEA,SAASA,EAAEA,OAAOA,EAAEA,YAAYA,IAAGS,CAACA;IAGvFT,kBAASA,GADhBA,UACiBA,KAAKA,EAAEA,QAAQA,EAAEA,KAAKA,EAAEA,SAASA,EAAEA,OAAOA,I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AASA,EAAEA,kBAAkBA;SAC9BA,CAACA;iBAoDDA;IAADA,eAACA;AAADA,CAACA,AAxDD,IAwDC;AAnDY,gBAAQ,WAmDpB,CAAA"}
\ No newline at end of file
diff --git a/dist/plugins/camera.js b/dist/plugins/camera.js
index f6072b2e9..b4122a989 100644
--- a/dist/plugins/camera.js
+++ b/dist/plugins/camera.js
@@ -1,8 +1,10 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
+ case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
+ case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
+ }
};
var plugin_1 = require('./plugin');
var Camera = (function () {
@@ -12,15 +14,17 @@ var Camera = (function () {
;
Camera.cleanup = function () { };
;
- __decorate([
- plugin_1.Cordova({
- // Not sure why this plugin has the success/err come first...
- callbackOrder: 'reverse'
- })
- ], Camera, "getPicture", null);
- __decorate([
- plugin_1.Cordova()
- ], Camera, "cleanup", null);
+ Object.defineProperty(Camera, "getPicture",
+ __decorate([
+ plugin_1.Cordova({
+ // Not sure why this plugin has the success/err come first...
+ callbackOrder: 'reverse'
+ })
+ ], Camera, "getPicture", Object.getOwnPropertyDescriptor(Camera, "getPicture")));
+ Object.defineProperty(Camera, "cleanup",
+ __decorate([
+ plugin_1.Cordova()
+ ], Camera, "cleanup", Object.getOwnPropertyDescriptor(Camera, "cleanup")));
Camera = __decorate([
plugin_1.Plugin({
name: 'Camera',
diff --git a/dist/plugins/camera.js.map b/dist/plugins/camera.js.map
index 5aad4c7e1..703fe4cf9 100644
--- a/dist/plugins/camera.js.map
+++ b/dist/plugins/camera.js.map
@@ -1 +1 @@
-{"version":3,"file":"camera.js","sourceRoot":"","sources":["../../src/plugins/camera.ts"],"names":["Camera","Camera.constructor","Camera.getPicture","Camera.cleanup"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IAcAC,CAACA;IAJQD,iBAAUA,GAJjBA,UAIkBA,OAAWA,IAAEE,CAACA;;IAGzBF,cAAOA,GADdA,cACiBG,CAACA;;IAPlBH;QAACA,gBAAOA,CAACA;YACPA,6DAA6DA;YAC7DA,aAAaA,EAAEA,SAASA;SACzBA,CAACA;OACKA,oBAAUA,QAAeA;IAEhCA;QAACA,gBAAOA,EAAEA;OACHA,iBAAOA,QAAIA;IAbpBA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,QAAQA;YACdA,MAAMA,EAAEA,uBAAuBA;YAC/BA,SAASA,EAAEA,kBAAkBA;SAC9BA,CAACA;eAUDA;IAADA,aAACA;AAADA,CAACA,AAdD,IAcC;AATY,cAAM,SASlB,CAAA"}
\ No newline at end of file
+{"version":3,"file":"camera.js","sourceRoot":"","sources":["../../src/plugins/camera.ts"],"names":["Camera","Camera.constructor","Camera.getPicture","Camera.cleanup"],"mappings":";;;;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IAcAC,CAACA;IAJQD,iBAAUA,GAJjBA,UAIkBA,OAAWA,IAAEE,CAACA;;IAGzBF,cAAOA,GADdA,cACiBG,CAACA;;IAPlBH,sBAIOA,oBAAUA;;YAJhBA,gBAAOA,CAACA;gBACPA,6DAA6DA;gBAC7DA,aAAaA,EAAEA,SAASA;aACzBA,CAACA;WACKA,oBAAUA,kCAAVA,oBAAUA,IAAeA;IAEhCA,sBACOA,iBAAOA;;YADbA,gBAAOA,EAAEA;WACHA,iBAAOA,kCAAPA,iBAAOA,IAAIA;IAbpBA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,QAAQA;YACdA,MAAMA,EAAEA,uBAAuBA;YAC/BA,SAASA,EAAEA,kBAAkBA;SAC9BA,CAACA;eAUDA;IAADA,aAACA;AAADA,CAACA,AAdD,IAcC;AATY,cAAM,SASlB,CAAA"}
\ No newline at end of file
diff --git a/dist/plugins/contacts.js b/dist/plugins/contacts.js
index 6c472824b..00342bdfc 100644
--- a/dist/plugins/contacts.js
+++ b/dist/plugins/contacts.js
@@ -1,8 +1,10 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
+ case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
+ case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
+ }
};
var plugin_1 = require('./plugin');
var Contacts = (function () {
@@ -14,21 +16,24 @@ var Contacts = (function () {
;
Contacts.pickContact = function () { };
;
- __decorate([
- plugin_1.Cordova({
- successIndex: 1,
- errorIndex: 2
- })
- ], Contacts, "create", null);
- __decorate([
- plugin_1.Cordova({
- successIndex: 1,
- errorIndex: 2
- })
- ], Contacts, "find", null);
- __decorate([
- plugin_1.Cordova()
- ], Contacts, "pickContact", null);
+ Object.defineProperty(Contacts, "create",
+ __decorate([
+ plugin_1.Cordova({
+ successIndex: 1,
+ errorIndex: 2
+ })
+ ], Contacts, "create", Object.getOwnPropertyDescriptor(Contacts, "create")));
+ Object.defineProperty(Contacts, "find",
+ __decorate([
+ plugin_1.Cordova({
+ successIndex: 1,
+ errorIndex: 2
+ })
+ ], Contacts, "find", Object.getOwnPropertyDescriptor(Contacts, "find")));
+ Object.defineProperty(Contacts, "pickContact",
+ __decorate([
+ plugin_1.Cordova()
+ ], Contacts, "pickContact", Object.getOwnPropertyDescriptor(Contacts, "pickContact")));
Contacts = __decorate([
plugin_1.Plugin({
name: 'Contacts',
diff --git a/dist/plugins/contacts.js.map b/dist/plugins/contacts.js.map
index 2f5997d6d..4173212f1 100644
--- a/dist/plugins/contacts.js.map
+++ b/dist/plugins/contacts.js.map
@@ -1 +1 @@
-{"version":3,"file":"contacts.js","sourceRoot":"","sources":["../../src/plugins/contacts.ts"],"names":["Contacts","Contacts.constructor","Contacts.create","Contacts.find","Contacts.pickContact"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IAsBAC,CAACA;IAVQD,eAAMA,GALbA,UAKcA,MAAeA,EAAEA,OAAWA,IAAEE,CAACA;;IAMtCF,aAAIA,GAJXA,UAIYA,MAAeA,EAAEA,OAAWA,IAAEG,CAACA;;IAGpCH,oBAAWA,GADlBA,cACqBI,CAACA;;IAdtBJ;QAACA,gBAAOA,CAACA;YACPA,YAAYA,EAAEA,CAACA;YACfA,UAAUA,EAAEA,CAACA;SACdA,CAACA;OAEKA,kBAAMA,QAAgCA;IAE7CA;QAACA,gBAAOA,CAACA;YACPA,YAAYA,EAAEA,CAACA;YACfA,UAAUA,EAAEA,CAACA;SACdA,CAACA;OACKA,gBAAIA,QAAgCA;IAE3CA;QAACA,gBAAOA,EAAEA;OACHA,uBAAWA,QAAIA;IArBxBA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,UAAUA;YAChBA,MAAMA,EAAEA,yBAAyBA;YACjCA,SAASA,EAAEA,oBAAoBA;YAC/BA,IAAIA,EAAEA,mDAAmDA;SAC1DA,CAACA;iBAiBDA;IAADA,eAACA;AAADA,CAACA,AAtBD,IAsBC;AAhBY,gBAAQ,WAgBpB,CAAA"}
\ No newline at end of file
+{"version":3,"file":"contacts.js","sourceRoot":"","sources":["../../src/plugins/contacts.ts"],"names":["Contacts","Contacts.constructor","Contacts.create","Contacts.find","Contacts.pickContact"],"mappings":";;;;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IAsBAC,CAACA;IAVQD,eAAMA,GALbA,UAKcA,MAAeA,EAAEA,OAAWA,IAAEE,CAACA;;IAMtCF,aAAIA,GAJXA,UAIYA,MAAeA,EAAEA,OAAWA,IAAEG,CAACA;;IAGpCH,oBAAWA,GADlBA,cACqBI,CAACA;;IAdtBJ,sBAKOA,kBAAMA;;YALZA,gBAAOA,CAACA;gBACPA,YAAYA,EAAEA,CAACA;gBACfA,UAAUA,EAAEA,CAACA;aACdA,CAACA;WAEKA,kBAAMA,kCAANA,kBAAMA,IAAgCA;IAE7CA,sBAIOA,gBAAIA;;YAJVA,gBAAOA,CAACA;gBACPA,YAAYA,EAAEA,CAACA;gBACfA,UAAUA,EAAEA,CAACA;aACdA,CAACA;WACKA,gBAAIA,kCAAJA,gBAAIA,IAAgCA;IAE3CA,sBACOA,uBAAWA;;YADjBA,gBAAOA,EAAEA;WACHA,uBAAWA,kCAAXA,uBAAWA,IAAIA;IArBxBA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,UAAUA;YAChBA,MAAMA,EAAEA,yBAAyBA;YACjCA,SAASA,EAAEA,oBAAoBA;YAC/BA,IAAIA,EAAEA,mDAAmDA;SAC1DA,CAACA;iBAiBDA;IAADA,eAACA;AAADA,CAACA,AAtBD,IAsBC;AAhBY,gBAAQ,WAgBpB,CAAA"}
\ No newline at end of file
diff --git a/dist/plugins/device.js b/dist/plugins/device.js
index fef6fb922..0fd6d634e 100644
--- a/dist/plugins/device.js
+++ b/dist/plugins/device.js
@@ -1,8 +1,10 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
+ case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
+ case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
+ }
};
var plugin_1 = require('./plugin');
var Device = (function () {
@@ -11,9 +13,10 @@ var Device = (function () {
Device.getDevice = function () {
return window.device;
};
- __decorate([
- plugin_1.RequiresPlugin
- ], Device, "getDevice", null);
+ Object.defineProperty(Device, "getDevice",
+ __decorate([
+ plugin_1.RequiresPlugin
+ ], Device, "getDevice", Object.getOwnPropertyDescriptor(Device, "getDevice")));
Device = __decorate([
plugin_1.Plugin({
name: 'Device',
diff --git a/dist/plugins/device.js.map b/dist/plugins/device.js.map
index 6d9146ffb..366b2c962 100644
--- a/dist/plugins/device.js.map
+++ b/dist/plugins/device.js.map
@@ -1 +1 @@
-{"version":3,"file":"device.js","sourceRoot":"","sources":["../../src/plugins/device.ts"],"names":["Device","Device.constructor","Device.getDevice"],"mappings":";;;;;;AAAA,uBAAqC,UAAU,CAAC,CAAA;AAIhD;IAAAA;IAWAC,CAACA;IAHQD,gBAASA,GADhBA;QAEEE,MAAMA,CAACA,MAAMA,CAACA,MAAMA,CAACA;IACvBA,CAACA;IAHDF;QAACA,uBAAcA;OACRA,mBAASA,QAEfA;IAVHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,QAAQA;YACdA,MAAMA,EAAEA,uBAAuBA;YAC/BA,SAASA,EAAEA,QAAQA;SACpBA,CAACA;eAODA;IAADA,aAACA;AAADA,CAACA,AAXD,IAWC;AANY,cAAM,SAMlB,CAAA"}
\ No newline at end of file
+{"version":3,"file":"device.js","sourceRoot":"","sources":["../../src/plugins/device.ts"],"names":["Device","Device.constructor","Device.getDevice"],"mappings":";;;;;;;;AAAA,uBAAqC,UAAU,CAAC,CAAA;AAIhD;IAAAA;IAWAC,CAACA;IAHQD,gBAASA,GADhBA;QAEEE,MAAMA,CAACA,MAAMA,CAACA,MAAMA,CAACA;IACvBA,CAACA;IAHDF,sBACOA,mBAASA;;YADfA,uBAAcA;WACRA,mBAASA,kCAATA,mBAASA,IAEfA;IAVHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,QAAQA;YACdA,MAAMA,EAAEA,uBAAuBA;YAC/BA,SAASA,EAAEA,QAAQA;SACpBA,CAACA;eAODA;IAADA,aAACA;AAADA,CAACA,AAXD,IAWC;AANY,cAAM,SAMlB,CAAA"}
\ No newline at end of file
diff --git a/dist/plugins/facebook.js b/dist/plugins/facebook.js
index 25682951f..8fc60f35b 100644
--- a/dist/plugins/facebook.js
+++ b/dist/plugins/facebook.js
@@ -1,8 +1,10 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
+ case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
+ case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
+ }
};
var plugin_1 = require('./plugin');
var Facebook = (function () {
@@ -17,33 +19,42 @@ var Facebook = (function () {
Facebook.logEvent = function (name, params, valueToSum) { };
Facebook.logPurchase = function (value, currency) { };
Facebook.appInvite = function (options) { };
- __decorate([
- plugin_1.Cordova()
- ], Facebook, "login", null);
- __decorate([
- plugin_1.Cordova()
- ], Facebook, "logout", null);
- __decorate([
- plugin_1.Cordova()
- ], Facebook, "getLoginStatus", null);
- __decorate([
- plugin_1.Cordova()
- ], Facebook, "getAccessToken", null);
- __decorate([
- plugin_1.Cordova()
- ], Facebook, "showDialog", null);
- __decorate([
- plugin_1.Cordova()
- ], Facebook, "api", null);
- __decorate([
- plugin_1.Cordova()
- ], Facebook, "logEvent", null);
- __decorate([
- plugin_1.Cordova()
- ], Facebook, "logPurchase", null);
- __decorate([
- plugin_1.Cordova()
- ], Facebook, "appInvite", null);
+ Object.defineProperty(Facebook, "login",
+ __decorate([
+ plugin_1.Cordova()
+ ], Facebook, "login", Object.getOwnPropertyDescriptor(Facebook, "login")));
+ Object.defineProperty(Facebook, "logout",
+ __decorate([
+ plugin_1.Cordova()
+ ], Facebook, "logout", Object.getOwnPropertyDescriptor(Facebook, "logout")));
+ Object.defineProperty(Facebook, "getLoginStatus",
+ __decorate([
+ plugin_1.Cordova()
+ ], Facebook, "getLoginStatus", Object.getOwnPropertyDescriptor(Facebook, "getLoginStatus")));
+ Object.defineProperty(Facebook, "getAccessToken",
+ __decorate([
+ plugin_1.Cordova()
+ ], Facebook, "getAccessToken", Object.getOwnPropertyDescriptor(Facebook, "getAccessToken")));
+ Object.defineProperty(Facebook, "showDialog",
+ __decorate([
+ plugin_1.Cordova()
+ ], Facebook, "showDialog", Object.getOwnPropertyDescriptor(Facebook, "showDialog")));
+ Object.defineProperty(Facebook, "api",
+ __decorate([
+ plugin_1.Cordova()
+ ], Facebook, "api", Object.getOwnPropertyDescriptor(Facebook, "api")));
+ Object.defineProperty(Facebook, "logEvent",
+ __decorate([
+ plugin_1.Cordova()
+ ], Facebook, "logEvent", Object.getOwnPropertyDescriptor(Facebook, "logEvent")));
+ Object.defineProperty(Facebook, "logPurchase",
+ __decorate([
+ plugin_1.Cordova()
+ ], Facebook, "logPurchase", Object.getOwnPropertyDescriptor(Facebook, "logPurchase")));
+ Object.defineProperty(Facebook, "appInvite",
+ __decorate([
+ plugin_1.Cordova()
+ ], Facebook, "appInvite", Object.getOwnPropertyDescriptor(Facebook, "appInvite")));
Facebook = __decorate([
plugin_1.Plugin({
name: 'Facebook',
diff --git a/dist/plugins/facebook.js.map b/dist/plugins/facebook.js.map
index 16d884b56..b854b6b36 100644
--- a/dist/plugins/facebook.js.map
+++ b/dist/plugins/facebook.js.map
@@ -1 +1 @@
-{"version":3,"file":"facebook.js","sourceRoot":"","sources":["../../src/plugins/facebook.ts"],"names":["Facebook","Facebook.constructor","Facebook.login","Facebook.logout","Facebook.getLoginStatus","Facebook.getAccessToken","Facebook.showDialog","Facebook.api","Facebook.logEvent","Facebook.logPurchase","Facebook.appInvite"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IAgCAC,CAACA;IAzBQD,cAAKA,GADZA,UACaA,WAAoBA,IAAEE,CAACA;IAG7BF,eAAMA,GADbA,cACgBG,CAACA;IAGVH,uBAAcA,GADrBA,cACwBI,CAACA;IAGlBJ,uBAAcA,GADrBA,cACwBK,CAACA;IAGlBL,mBAAUA,GADjBA,UACkBA,OAAWA,IAAEM,CAACA;IAGzBN,YAAGA,GADVA,UACWA,WAAkBA,EAAEA,WAAoBA,IAAEO,CAACA;IAG/CP,iBAAQA,GADfA,UACgBA,IAAWA,EAAEA,MAAUA,EAAEA,UAAiBA,IAAEQ,CAACA;IAGtDR,oBAAWA,GADlBA,UACmBA,KAAYA,EAAEA,QAAeA,IAAES,CAACA;IAG5CT,kBAASA,GADhBA,UACiBA,OAAWA,IAAEU,CAACA;IAzB/BV;QAACA,gBAAOA,EAAEA;OACHA,iBAAKA,QAAwBA;IAEpCA;QAACA,gBAAOA,EAAEA;OACHA,kBAAMA,QAAIA;IAEjBA;QAACA,gBAAOA,EAAEA;OACHA,0BAAcA,QAAIA;IAEzBA;QAACA,gBAAOA,EAAEA;OACHA,0BAAcA,QAAIA;IAEzBA;QAACA,gBAAOA,EAAEA;OACHA,sBAAUA,QAAeA;IAEhCA;QAACA,gBAAOA,EAAEA;OACHA,eAAGA,QAA4CA;IAEtDA;QAACA,gBAAOA,EAAEA;OACHA,oBAAQA,QAA8CA;IAE7DA;QAACA,gBAAOA,EAAEA;OACHA,uBAAWA,QAAiCA;IAEnDA;QAACA,gBAAOA,EAAEA;OACHA,qBAASA,QAAeA;IA/BjCA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,UAAUA;YAChBA,MAAMA,EAAEA,0BAA0BA;YAClCA,SAASA,EAAEA,uBAAuBA;SACnCA,CAACA;iBA4BDA;IAADA,eAACA;AAADA,CAACA,AAhCD,IAgCC;AA3BY,gBAAQ,WA2BpB,CAAA"}
\ No newline at end of file
+{"version":3,"file":"facebook.js","sourceRoot":"","sources":["../../src/plugins/facebook.ts"],"names":["Facebook","Facebook.constructor","Facebook.login","Facebook.logout","Facebook.getLoginStatus","Facebook.getAccessToken","Facebook.showDialog","Facebook.api","Facebook.logEvent","Facebook.logPurchase","Facebook.appInvite"],"mappings":";;;;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IAgCAC,CAACA;IAzBQD,cAAKA,GADZA,UACaA,WAAoBA,IAAEE,CAACA;IAG7BF,eAAMA,GADbA,cACgBG,CAACA;IAGVH,uBAAcA,GADr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SAASA,EAAEA,uBAAuBA;SACnCA,CAACA;iBA4BDA;IAADA,eAACA;AAADA,CAACA,AAhCD,IAgCC;AA3BY,gBAAQ,WA2BpB,CAAA"}
\ No newline at end of file
diff --git a/dist/plugins/geolocation.js b/dist/plugins/geolocation.js
index ab15f94a6..8a1cbaf65 100644
--- a/dist/plugins/geolocation.js
+++ b/dist/plugins/geolocation.js
@@ -1,8 +1,10 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
+ case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
+ case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
+ }
};
var plugin_1 = require('./plugin');
var Geolocation = (function () {
@@ -12,16 +14,18 @@ var Geolocation = (function () {
;
Geolocation.watchPosition = function (options) { };
;
- __decorate([
- plugin_1.Cordova()
- ], Geolocation, "getCurrentPosition", null);
- __decorate([
- plugin_1.Cordova({
- callbackOrder: 'reverse',
- observable: true,
- clearFunction: 'clearWatch()'
- })
- ], Geolocation, "watchPosition", null);
+ Object.defineProperty(Geolocation, "getCurrentPosition",
+ __decorate([
+ plugin_1.Cordova()
+ ], Geolocation, "getCurrentPosition", Object.getOwnPropertyDescriptor(Geolocation, "getCurrentPosition")));
+ Object.defineProperty(Geolocation, "watchPosition",
+ __decorate([
+ plugin_1.Cordova({
+ callbackOrder: 'reverse',
+ observable: true,
+ clearFunction: 'clearWatch()'
+ })
+ ], Geolocation, "watchPosition", Object.getOwnPropertyDescriptor(Geolocation, "watchPosition")));
Geolocation = __decorate([
plugin_1.Plugin({
name: 'Geolocation',
diff --git a/dist/plugins/geolocation.js.map b/dist/plugins/geolocation.js.map
index 3ec0bff52..e5c52f94c 100644
--- a/dist/plugins/geolocation.js.map
+++ b/dist/plugins/geolocation.js.map
@@ -1 +1 @@
-{"version":3,"file":"geolocation.js","sourceRoot":"","sources":["../../src/plugins/geolocation.ts"],"names":["Geolocation","Geolocation.constructor","Geolocation.getCurrentPosition","Geolocation.watchPosition"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAMzC;IAAAA;IAgBAC,CAACA;IATQD,8BAAkBA,GADzBA,UAC0BA,OAAWA,IAAEE,CAACA;;IAQjCF,yBAAaA,GALpBA,UAKqBA,OAAWA,IAAEG,CAACA;;IATnCH;QAACA,gBAAOA,EAAEA;OACHA,iCAAkBA,QAAeA;IAGxCA;QAACA,gBAAOA,CAACA;YACPA,aAAaA,EAAEA,SAASA;YACxBA,UAAUA,EAAEA,IAAIA;YAChBA,aAAaA,EAAEA,cAAcA;SAC9BA,CAACA;OACKA,4BAAaA,QAAeA;IAfrCA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,aAAaA;YACnBA,MAAMA,EAAEA,4BAA4BA;YACpCA,SAASA,EAAEA,uBAAuBA;SACnCA,CAACA;oBAYDA;IAADA,kBAACA;AAADA,CAACA,AAhBD,IAgBC;AAXY,mBAAW,cAWvB,CAAA"}
\ No newline at end of file
+{"version":3,"file":"geolocation.js","sourceRoot":"","sources":["../../src/plugins/geolocation.ts"],"names":["Geolocation","Geolocation.constructor","Geolocation.getCurrentPosition","Geolocation.watchPosition"],"mappings":";;;;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAMzC;IAAAA;IAgBAC,CAACA;IATQD,8BAAkBA,GADzBA,UAC0BA,OAAWA,IAAEE,CAACA;;IAQjCF,yBAAaA,GALpBA,UAKqBA,OAAWA,IAAEG,CAACA;;IATnCH,sBACOA,iCAAkBA;;YADxBA,gBAAOA,EAAEA;WACHA,iCAAkBA,kCAAlBA,iCAAkBA,IAAeA;IAGxCA,sBAKOA,4BAAaA;;YALnBA,gBAAOA,CAACA;gBACPA,aAAaA,EAAEA,SAASA;gBACxBA,UAAUA,EAAEA,IAAIA;gBAChBA,aAAaA,EAAEA,cAAcA;aAC9BA,CAACA;WACKA,4BAAaA,kCAAbA,4BAAaA,IAAeA;IAfrCA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,aAAaA;YACnBA,MAAMA,EAAEA,4BAA4BA;YACpCA,SAASA,EAAEA,uBAAuBA;SACnCA,CAACA;oBAYDA;IAADA,kBAACA;AAADA,CAACA,AAhBD,IAgBC;AAXY,mBAAW,cAWvB,CAAA"}
\ No newline at end of file
diff --git a/dist/plugins/plugin.js b/dist/plugins/plugin.js
index 9174b454a..7e67aa506 100644
--- a/dist/plugins/plugin.js
+++ b/dist/plugins/plugin.js
@@ -65,9 +65,27 @@ function callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject) {
// TODO: Illegal invocation needs window context
return util_1.get(window, pluginObj.pluginRef)[methodName].apply(pluginInstance, args);
}
+function getPromise(cb) {
+ if (window.Promise) {
+ console.log('Native promises available...');
+ return new Promise(function (resolve, reject) {
+ cb(resolve, reject);
+ });
+ }
+ else if (window.angular) {
+ var $q_1 = window.angular.injector(['ng']).get('$q');
+ console.log('Loaded $q', $q_1);
+ return $q_1(function (resolve, reject) {
+ cb(resolve, reject);
+ });
+ }
+ else {
+ console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 1/2 or on a recent browser.');
+ }
+}
function wrapPromise(pluginObj, methodName, args, opts) {
if (opts === void 0) { opts = {}; }
- return new Promise(function (resolve, reject) {
+ return getPromise(function (resolve, reject) {
callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
});
}
@@ -110,6 +128,9 @@ function Plugin(config) {
for (var k in config) {
cls[k] = config[k];
}
+ cls['installed'] = function () {
+ return !!exports.getPlugin(config.pluginRef);
+ };
return cls;
};
}
diff --git a/dist/plugins/plugin.js.map b/dist/plugins/plugin.js.map
index 9d769c2ad..661067729 100644
--- a/dist/plugins/plugin.js.map
+++ b/dist/plugins/plugin.js.map
@@ -1 +1 @@
-{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugins/plugin.ts"],"names":["callCordovaPlugin","wrapPromise","wrapObservable","Plugin","Cordova","RequiresPlugin"],"mappings":"AAAA,qBAAkB,SAAS,CAAC,CAAA;AAK5B,mBAAyB,6BAA6B,CAAC,CAAA;AAG1C,iBAAS,GAAG,UAAS,SAAiB;IACjD,MAAM,CAAC,UAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAChC,CAAC,CAAA;AACY,mBAAW,GAAG,UAAS,SAAiB;IACnD,MAAM,CAAC,CAAC,CAAC,iBAAS,CAAC,SAAS,CAAC,CAAC;AAChC,CAAC,CAAA;AACY,kBAAU,GAAG,UAAS,UAAkB,EAAE,MAAc,EAAE,MAAc;IACnF,EAAE,CAAA,CAAC,MAAM,CAAC,CAAC,CAAC;QACV,OAAO,CAAC,IAAI,CAAC,wBAAwB,GAAG,UAAU,GAAG,GAAG,GAAG,MAAM;YAC/D,YAAY,GAAG,UAAU,GAAG,wCAAwC;YACpE,MAAM,GAAG,SAAS,CAAC,CAAC;IACxB,CAAC;IAAC,IAAI,CAAC,CAAC;QACN,OAAO,CAAC,IAAI,CAAC,8BAA8B,GAAG,UAAU,GAAG,+CAA+C,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;IACnI,CAAC;AACH,CAAC,CAAA;AACY,mBAAW,GAAG,UAAS,UAAkB,EAAE,MAAc;IACpE,EAAE,CAAA,CAAC,MAAM,CAAC,CAAC,CAAC;QACV,OAAO,CAAC,IAAI,CAAC,wBAAwB,G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C,SAAS,CAAC,CAAC;QAC/C,EAAE,CAAA,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC;YACnB,kBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACvC,MAAM,CAAC;QACT,CAAC;QACD,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC,CAAAA;IAEDA,MAAMA,CAACA,UAAUA,CAACA;AACpBA,CAACA;AAnBe,sBAAc,iBAmB7B,CAAA"}
\ No newline at end of file
+{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugins/plugin.ts"],"names":["callCordovaPlugin","getPromise","wrapPromise","wrapObservable","Plugin","Cordova","RequiresPlugin"],"mappings":"AAAA,qBAAkB,SAAS,CAAC,CAAA;AAQ5B,mBAAyB,6BAA6B,CAAC,CAAA;AAG1C,iBAAS,GAAG,UAAS,SAAiB;IACjD,MAAM,CAAC,UAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAChC,CAAC,CAAA;AACY,mBAAW,GAAG,UAAS,SAAiB;IACnD,MAAM,CAAC,CAAC,CAAC,iBAAS,CAAC,SAAS,CAAC,CAAC;AAChC,CAAC,CAAA;AACY,kBAAU,GAAG,UAAS,UAAkB,EAAE,MAAc,EAAE,MAAc;IACnF,EAAE,CAAA,CAAC,MAAM,CAAC,CAAC,CAAC;QACV,OAAO,CAAC,IAAI,CAAC,wBAAwB,GAAG,UAAU,GAAG,GAAG,GAAG,MAAM;YAC/D,YAAY,GAAG,UAAU,GAAG,wCAAwC;YACpE,MAAM,GAAG,SAAS,CAAC,CAAC;IACxB,CAAC;IAAC,IAAI,CAAC,CAAC;QACN,OAAO,CAAC,IAAI,CAAC,8BAA8B,GAAG,UAAU,GAAG,+CAA+C,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;IACnI,CAAC;AACH,CAAC,CAAA;AACY,mBAAW,GAAG,UAAS,UAAkB,EAAE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ACT,CAAC;QACD,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC,CAAAA;IAEDA,MAAMA,CAACA,UAAUA,CAACA;AACpBA,CAACA;AAnBe,sBAAc,iBAmB7B,CAAA"}
\ No newline at end of file
diff --git a/dist/plugins/statusbar.js b/dist/plugins/statusbar.js
index 956f413b9..dcf7cac1a 100644
--- a/dist/plugins/statusbar.js
+++ b/dist/plugins/statusbar.js
@@ -1,8 +1,10 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
+ case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
+ case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
+ }
};
var plugin_1 = require('./plugin');
var StatusBar = (function () {
@@ -26,33 +28,42 @@ var StatusBar = (function () {
;
StatusBar.show = function () { };
;
- __decorate([
- plugin_1.Cordova()
- ], StatusBar, "overlaysWebView", null);
- __decorate([
- plugin_1.Cordova()
- ], StatusBar, "styleDefault", null);
- __decorate([
- plugin_1.Cordova()
- ], StatusBar, "styleLightContent", null);
- __decorate([
- plugin_1.Cordova()
- ], StatusBar, "styleBlackTranslucent", null);
- __decorate([
- plugin_1.Cordova()
- ], StatusBar, "styleBlackOpaque", null);
- __decorate([
- plugin_1.Cordova()
- ], StatusBar, "backgroundColorByName", null);
- __decorate([
- plugin_1.Cordova()
- ], StatusBar, "backgroundColorByHexString", null);
- __decorate([
- plugin_1.Cordova()
- ], StatusBar, "hide", null);
- __decorate([
- plugin_1.Cordova()
- ], StatusBar, "show", null);
+ Object.defineProperty(StatusBar, "overlaysWebView",
+ __decorate([
+ plugin_1.Cordova()
+ ], StatusBar, "overlaysWebView", Object.getOwnPropertyDescriptor(StatusBar, "overlaysWebView")));
+ Object.defineProperty(StatusBar, "styleDefault",
+ __decorate([
+ plugin_1.Cordova()
+ ], StatusBar, "styleDefault", Object.getOwnPropertyDescriptor(StatusBar, "styleDefault")));
+ Object.defineProperty(StatusBar, "styleLightContent",
+ __decorate([
+ plugin_1.Cordova()
+ ], StatusBar, "styleLightContent", Object.getOwnPropertyDescriptor(StatusBar, "styleLightContent")));
+ Object.defineProperty(StatusBar, "styleBlackTranslucent",
+ __decorate([
+ plugin_1.Cordova()
+ ], StatusBar, "styleBlackTranslucent", Object.getOwnPropertyDescriptor(StatusBar, "styleBlackTranslucent")));
+ Object.defineProperty(StatusBar, "styleBlackOpaque",
+ __decorate([
+ plugin_1.Cordova()
+ ], StatusBar, "styleBlackOpaque", Object.getOwnPropertyDescriptor(StatusBar, "styleBlackOpaque")));
+ Object.defineProperty(StatusBar, "backgroundColorByName",
+ __decorate([
+ plugin_1.Cordova()
+ ], StatusBar, "backgroundColorByName", Object.getOwnPropertyDescriptor(StatusBar, "backgroundColorByName")));
+ Object.defineProperty(StatusBar, "backgroundColorByHexString",
+ __decorate([
+ plugin_1.Cordova()
+ ], StatusBar, "backgroundColorByHexString", Object.getOwnPropertyDescriptor(StatusBar, "backgroundColorByHexString")));
+ Object.defineProperty(StatusBar, "hide",
+ __decorate([
+ plugin_1.Cordova()
+ ], StatusBar, "hide", Object.getOwnPropertyDescriptor(StatusBar, "hide")));
+ Object.defineProperty(StatusBar, "show",
+ __decorate([
+ plugin_1.Cordova()
+ ], StatusBar, "show", Object.getOwnPropertyDescriptor(StatusBar, "show")));
StatusBar = __decorate([
plugin_1.Plugin({
name: 'StatusBar',
diff --git a/dist/plugins/statusbar.js.map b/dist/plugins/statusbar.js.map
index 12c0ba345..e65c83ac4 100644
--- a/dist/plugins/statusbar.js.map
+++ b/dist/plugins/statusbar.js.map
@@ -1 +1 @@
-{"version":3,"file":"statusbar.js","sourceRoot":"","sources":["../../src/plugins/statusbar.ts"],"names":["StatusBar","StatusBar.constructor","StatusBar.overlaysWebView","StatusBar.styleDefault","StatusBar.styleLightContent","StatusBar.styleBlackTranslucent","StatusBar.styleBlackOpaque","StatusBar.backgroundColorByName","StatusBar.backgroundColorByHexString","StatusBar.hide","StatusBar.show"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IAwBAC,CAACA;IAjBQD,yBAAeA,GADtBA,UACuBA,SAAiBA,IAAEE,CAACA;;IAEpCF,sBAAYA,GADnBA,cACsBG,CAACA;;IAEhBH,2BAAiBA,GADxBA,cAC2BI,CAACA;;IAErBJ,+BAAqBA,GAD5BA,cAC+BK,CAACA;;IAEzBL,0BAAgBA,GADvBA,cAC0BM,CAACA;;IAEpBN,+BAAqBA,GAD5BA,UAC6BA,SAAgBA,IAAEO,CAACA;;IAEzCP,oCAA0BA,GADjCA,UACkCA,SAAgBA,IAAEQ,CAACA;;IAE9CR,cAAIA,GADXA,cACcS,CAACA;;IAERT,cAAIA,GADXA,cACcU,CAACA;;IAjBfV;QAACA,gBAAOA,EAAEA;OACHA,4BAAeA,QAAqBA;IAC3CA;QAACA,gBAAOA,EAAEA;OACHA,yBAAYA,QAAIA;IACvBA;QAACA,gBAAOA,EAAEA;OACHA,8BAAiBA,QAAIA;IAC5BA;QAACA,gBAAOA,EAAEA;OACHA,kCAAqBA,QAAIA;IAChCA;QAACA,gBAAOA,EAAEA;OACHA,6BAAgBA,QAAIA;IAC3BA;QAACA,gBAAOA,EAAEA;OACHA,kCAAqBA,QAAoBA;IAChDA;QAACA,gBAAOA,EAAEA;OACHA,uCAA0BA,QAAoBA;IACrDA;QAACA,gBAAOA,EAAEA;OACHA,iBAAIA,QAAIA;IACfA;QAACA,gBAAOA,EAAEA;OACHA,iBAAIA,QAAIA;IAvBjBA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,WAAWA;YACjBA,MAAMA,EAAEA,0BAA0BA;YAClCA,SAASA,EAAEA,WAAWA;SACvBA,CAACA;kBAoBDA;IAADA,gBAACA;AAADA,CAACA,AAxBD,IAwBC;AAnBY,iBAAS,YAmBrB,CAAA"}
\ No newline at end of file
+{"version":3,"file":"statusbar.js","sourceRoot":"","sources":["../../src/plugins/statusbar.ts"],"names":["StatusBar","StatusBar.constructor","StatusBar.overlaysWebView","StatusBar.styleDefault","StatusBar.styleLightContent","StatusBar.styleBlackTranslucent","StatusBar.styleBlackOpaque","StatusBar.backgroundColorByName","StatusBar.backgroundColorByHexString","StatusBar.hide","StatusBar.show"],"mappings":";;;;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IAwBAC,CAACA;IAjBQD,yBAAeA,GADtBA,UACuBA,SAAiBA,IAAEE,CAACA;;IAEpCF,sBAAYA,GADnBA,cACsBG,CAACA;;IAEhBH,2BAAiBA,GADxBA,cAC2BI,CAACA;;IAErBJ,+BAAqBA,GAD5BA,cAC+BK,CAACA;;IAEzBL,0BAAgBA,GADvBA,cAC0BM,CAACA;;IAEpBN,+BAAqBA,GAD5BA,UAC6BA,SAAgBA,IAAEO,CAACA;;IAEzCP,oCAA0BA,GADjCA,UACkCA,SAAgBA,IAAEQ,CAACA;;IAE9CR,cAAIA,GADXA,cACcS,CAACA;;IAERT,cAAIA,GADXA,cACcU,CAACA;;IAjBfV,sBACOA,4BAAeA;;YADrBA,gBAAOA,EAAEA;WACHA,4BAAeA,kCAAfA,4BAAeA,IAAqBA;IAC3CA,sBACOA,yBAAYA;;YADlBA,gBAAOA,EAAEA;WACHA,yBAAYA,kCAAZA,yBAAYA,IAAIA;IACvBA,sBACOA,8BAAiBA;;YADvBA,gBAAOA,EAAEA;WACHA,8BAAiBA,kCAAjBA,8BAAiBA,IAAIA;IAC5BA,sBACOA,kCAAqBA;;YAD3BA,gBAAOA,EAAEA;WACHA,kCAAqBA,kCAArBA,kCAAqBA,IAAIA;IAChCA,sBACOA,6BAAgBA;;YADtBA,gBAAOA,EAAEA;WACHA,6BAAgBA,kCAAhBA,6BAAgBA,IAAIA;IAC3BA,sBACOA,kCAAqBA;;YAD3BA,gBAAOA,EAAEA;WACHA,kCAAqBA,kCAArBA,kCAAqBA,IAAoBA;IAChDA,sBACOA,uCAA0BA;;YADhCA,gBAAOA,EAAEA;WACHA,uCAA0BA,kCAA1BA,uCAA0BA,IAAoBA;IACrDA,sBACOA,iBAAIA;;YADVA,gBAAOA,EAAEA;WACHA,iBAAIA,kCAAJA,iBAAIA,IAAIA;IACfA,sBACOA,iBAAIA;;YADVA,gBAAOA,EAAEA;WACHA,iBAAIA,kCAAJA,iBAAIA,IAAIA;IAvBjBA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,WAAWA;YACjBA,MAAMA,EAAEA,0BAA0BA;YAClCA,SAASA,EAAEA,WAAWA;SACvBA,CAACA;kBAoBDA;IAADA,gBAACA;AAADA,CAACA,AAxBD,IAwBC;AAnBY,iBAAS,YAmBrB,CAAA"}
\ No newline at end of file
diff --git a/dist/plugins/toast.js b/dist/plugins/toast.js
index 47f91dd69..ec55d3a72 100644
--- a/dist/plugins/toast.js
+++ b/dist/plugins/toast.js
@@ -1,8 +1,10 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
+ case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
+ case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
+ }
};
var plugin_1 = require('./plugin');
var Toast = (function () {
@@ -12,12 +14,14 @@ var Toast = (function () {
;
Toast.showWithOptions = function (options) { };
;
- __decorate([
- plugin_1.Cordova()
- ], Toast, "hide", null);
- __decorate([
- plugin_1.Cordova()
- ], Toast, "showWithOptions", null);
+ Object.defineProperty(Toast, "hide",
+ __decorate([
+ plugin_1.Cordova()
+ ], Toast, "hide", Object.getOwnPropertyDescriptor(Toast, "hide")));
+ Object.defineProperty(Toast, "showWithOptions",
+ __decorate([
+ plugin_1.Cordova()
+ ], Toast, "showWithOptions", Object.getOwnPropertyDescriptor(Toast, "showWithOptions")));
Toast = __decorate([
plugin_1.Plugin({
name: 'Toast',
diff --git a/dist/plugins/toast.js.map b/dist/plugins/toast.js.map
index ab360832b..00b5a9920 100644
--- a/dist/plugins/toast.js.map
+++ b/dist/plugins/toast.js.map
@@ -1 +1 @@
-{"version":3,"file":"toast.js","sourceRoot":"","sources":["../../src/plugins/toast.ts"],"names":["Toast","Toast.constructor","Toast.hide","Toast.showWithOptions"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IAYAC,CAACA;IAJQD,UAAIA,GADXA,cACcE,CAACA;;IAGRF,qBAAeA,GADtBA,UACuBA,OAAWA,IAAEG,CAACA;;IAJrCH;QAACA,gBAAOA,EAAEA;OACHA,aAAIA,QAAIA;IAEfA;QAACA,gBAAOA,EAAEA;OACHA,wBAAeA,QAAeA;IAXvCA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,OAAOA;YACbA,MAAMA,EAAEA,wBAAwBA;YAChCA,SAASA,EAAEA,eAAeA;YAC1BA,IAAIA,EAAEA,yDAAyDA;SAChEA,CAACA;cAODA;IAADA,YAACA;AAADA,CAACA,AAZD,IAYC;AANY,aAAK,QAMjB,CAAA"}
\ No newline at end of file
+{"version":3,"file":"toast.js","sourceRoot":"","sources":["../../src/plugins/toast.ts"],"names":["Toast","Toast.constructor","Toast.hide","Toast.showWithOptions"],"mappings":";;;;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IAYAC,CAACA;IAJQD,UAAIA,GADXA,cACcE,CAACA;;IAGRF,qBAAeA,GADtBA,UACuBA,OAAWA,IAAEG,CAACA;;IAJrCH,sBACOA,aAAIA;;YADVA,gBAAOA,EAAEA;WACHA,aAAIA,kCAAJA,aAAIA,IAAIA;IAEfA,sBACOA,wBAAeA;;YADrBA,gBAAOA,EAAEA;WACHA,wBAAeA,kCAAfA,wBAAeA,IAAeA;IAXvCA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,OAAOA;YACbA,MAAMA,EAAEA,wBAAwBA;YAChCA,SAASA,EAAEA,eAAeA;YAC1BA,IAAIA,EAAEA,yDAAyDA;SAChEA,CAACA;cAODA;IAADA,YAACA;AAADA,CAACA,AAZD,IAYC;AANY,aAAK,QAMjB,CAAA"}
\ No newline at end of file
diff --git a/dist/src/index.js b/dist/src/index.js
index b8e161ab3..323754733 100644
--- a/dist/src/index.js
+++ b/dist/src/index.js
@@ -1,6 +1,8 @@
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
+var ng1_1 = require('./ng1');
+ng1_1.initAngular1();
var DEVICE_READY_TIMEOUT = 2000;
__export(require('./plugins/actionsheet'));
__export(require('./plugins/ble'));
@@ -12,6 +14,26 @@ __export(require('./plugins/facebook'));
__export(require('./plugins/geolocation'));
__export(require('./plugins/statusbar'));
__export(require('./plugins/toast'));
+var actionsheet_2 = require('./plugins/actionsheet');
+var ble_2 = require('./plugins/ble');
+var camera_2 = require('./plugins/camera');
+var calendar_2 = require('./plugins/calendar');
+var device_2 = require('./plugins/device');
+var facebook_2 = require('./plugins/facebook');
+var geolocation_2 = require('./plugins/geolocation');
+var statusbar_2 = require('./plugins/statusbar');
+var toast_2 = require('./plugins/toast');
+window['IonicNative'] = {
+ ActionSheet: actionsheet_2.ActionSheet,
+ BLE: ble_2.BLE,
+ Camera: camera_2.Camera,
+ Calendar: calendar_2.Calendar,
+ Device: device_2.Device,
+ Facebook: facebook_2.Facebook,
+ Geolocation: geolocation_2.Geolocation,
+ StatusBar: statusbar_2.StatusBar,
+ Toast: toast_2.Toast
+};
var before = +new Date;
var didFireReady = false;
document.addEventListener('deviceready', function () {
diff --git a/dist/src/index.js.map b/dist/src/index.js.map
index 09b5e7a4f..93e60d737 100644
--- a/dist/src/index.js.map
+++ b/dist/src/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,IAAM,oBAAoB,GAAG,IAAI,CAAC;AAElC,iBAAc,uBAAuB,CAAC,EAAA;AACtC,iBAAc,eAAe,CAAC,EAAA;AAC9B,iBAAc,kBAAkB,CAAC,EAAA;AACjC,iBAAc,oBAAoB,CAAC,EAAA;AACnC,iBAAc,oBAAoB,CAAC,EAAA;AACnC,iBAAc,kBAAkB,CAAC,EAAA;AACjC,iBAAc,oBAAoB,CAAC,EAAA;AACnC,iBAAc,uBAAuB,CAAC,EAAA;AACtC,iBAAc,qBAAqB,CAAC,EAAA;AACpC,iBAAc,iBAAiB,CAAC,EAAA;AAShC,IAAI,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC;AAEvB,IAAI,YAAY,GAAG,KAAK,CAAC;AACzB,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE;IACvC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,CAAC,CAAC,IAAI,IAAI,GAAG,MAAM,CAAC,EAAE,IAAI,CAAC,C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AAE,mBAAQ;IAClB,MAAM,EAAE,eAAM;IACd,QAAQ,EAAE,mBAAQ;IAClB,WAAW,EAAE,yBAAW;IACxB,SAAS,EAAE,qBAAS;IACpB,KAAK,EAAE,aAAK;CACb,CAAA;AAMD,IAAI,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC;AAEvB,IAAI,YAAY,GAAG,KAAK,CAAC;AACzB,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE;IACvC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,CAAC,CAAC,IAAI,IAAI,GAAG,MAAM,CAAC,EAAE,IAAI,CAAC,CAAA;IACnE,YAAY,GAAG,IAAI,CAAC;AACtB,CAAC,CAAC,CAAA;AAEF,UAAU,CAAC;IACT,EAAE,CAAA,CAAC,CAAC,YAAY,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QACnC,OAAO,CAAC,IAAI,CAAC,0CAA0C,GAAG,oBAAoB,GAAG,0HAA0H,CAAC,CAAC;IAC/M,CAAC;AACH,CAAC,EAAE,oBAAoB,CAAC,CAAC"}
\ No newline at end of file
diff --git a/dist/src/ng1.d.ts b/dist/src/ng1.d.ts
new file mode 100644
index 000000000..b86d9b1bb
--- /dev/null
+++ b/dist/src/ng1.d.ts
@@ -0,0 +1,2 @@
+export declare function initAngular1(): void;
+export declare function publishAngular1Service(config: any, cls: any): void;
diff --git a/dist/src/ng1.js b/dist/src/ng1.js
new file mode 100644
index 000000000..819d66c44
--- /dev/null
+++ b/dist/src/ng1.js
@@ -0,0 +1,18 @@
+function initAngular1() {
+ if (window.angular) {
+ window.angular.module('ngCordova', []);
+ }
+}
+exports.initAngular1 = initAngular1;
+function publishAngular1Service(config, cls) {
+ var serviceName = '$cordova' + cls.name;
+ console.log('Registering Angular1 service', serviceName);
+ window.angular.module('ngCordova').service(serviceName, [function () {
+ var funcs = {};
+ for (var k in cls) {
+ }
+ return funcs;
+ }]);
+}
+exports.publishAngular1Service = publishAngular1Service;
+//# sourceMappingURL=ng1.js.map
\ No newline at end of file
diff --git a/dist/src/ng1.js.map b/dist/src/ng1.js.map
new file mode 100644
index 000000000..58c0ccb23
--- /dev/null
+++ b/dist/src/ng1.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"ng1.js","sourceRoot":"","sources":["../../src/ng1.ts"],"names":["initAngular1","publishAngular1Service"],"mappings":"AAKA;IACEA,EAAEA,CAAAA,CAACA,MAAMA,CAACA,OAAOA,CAACA,CAACA,CAACA;QAClBA,MAAMA,CAACA,OAAOA,CAACA,MAAMA,CAACA,WAAWA,EAAEA,EAAEA,CAACA,CAACA;IACzCA,CAACA;AACHA,CAACA;AAJe,oBAAY,eAI3B,CAAA;AAKD,gCAAuC,MAAU,EAAE,GAAO;IACxDC,IAAIA,WAAWA,GAAGA,UAAUA,GAAGA,GAAGA,CAACA,IAAIA,CAACA;IACxCA,OAAOA,CAACA,GAAGA,CAACA,8BAA8BA,EAAEA,WAAWA,CAACA,CAACA;IACzDA,MAAMA,CAACA,OAAOA,CAACA,MAAMA,CAACA,WAAWA,CAACA,CAACA,OAAOA,CAACA,WAAWA,EAAEA,CAACA;YACvD,IAAI,KAAK,GAAG,EAAE,CAAC;YACf,GAAG,CAAA,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;YACnB,CAAC;YACD,MAAM,CAAC,KAAK,CAAC;QACf,CAAC,CAACA,CAACA,CAACA;AACNA,CAACA;AATe,8BAAsB,yBASrC,CAAA"}
\ No newline at end of file
diff --git a/dist/src/plugins/geolocation.d.ts b/dist/src/plugins/geolocation.d.ts
index af91f15c9..8d814b732 100644
--- a/dist/src/plugins/geolocation.d.ts
+++ b/dist/src/plugins/geolocation.d.ts
@@ -1,4 +1,4 @@
-export declare class Geolocation {
- static getCurrentPosition(options: any): void;
- static watchPosition(options: any): void;
-}
+export declare class Geolocation {
+ static getCurrentPosition(options: any): void;
+ static watchPosition(options: any): void;
+}
diff --git a/dist/src/plugins/geolocation.js b/dist/src/plugins/geolocation.js
index ab15f94a6..50d5703a6 100644
--- a/dist/src/plugins/geolocation.js
+++ b/dist/src/plugins/geolocation.js
@@ -1,35 +1,45 @@
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var plugin_1 = require('./plugin');
-var Geolocation = (function () {
- function Geolocation() {
- }
- Geolocation.getCurrentPosition = function (options) { };
- ;
- Geolocation.watchPosition = function (options) { };
- ;
- __decorate([
- plugin_1.Cordova()
- ], Geolocation, "getCurrentPosition", null);
- __decorate([
- plugin_1.Cordova({
- callbackOrder: 'reverse',
- observable: true,
- clearFunction: 'clearWatch()'
- })
- ], Geolocation, "watchPosition", null);
- Geolocation = __decorate([
- plugin_1.Plugin({
- name: 'Geolocation',
- plugin: 'cordova-plugin-geolocation',
- pluginRef: 'navigator.geolocation'
- })
- ], Geolocation);
- return Geolocation;
-})();
-exports.Geolocation = Geolocation;
+var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
+};
+var __metadata = (this && this.__metadata) || function (k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
+};
+var plugin_1 = require('./plugin');
+var Geolocation = (function () {
+ function Geolocation() {
+ }
+ Geolocation.getCurrentPosition = function (options) { };
+ ;
+ Geolocation.watchPosition = function (options) { };
+ ;
+ __decorate([
+ plugin_1.Cordova(),
+ __metadata('design:type', Function),
+ __metadata('design:paramtypes', [Object]),
+ __metadata('design:returntype', void 0)
+ ], Geolocation, "getCurrentPosition", null);
+ __decorate([
+ plugin_1.Cordova({
+ callbackOrder: 'reverse',
+ observable: true,
+ clearFunction: 'clearWatch()'
+ }),
+ __metadata('design:type', Function),
+ __metadata('design:paramtypes', [Object]),
+ __metadata('design:returntype', void 0)
+ ], Geolocation, "watchPosition", null);
+ Geolocation = __decorate([
+ plugin_1.Plugin({
+ name: 'Geolocation',
+ plugin: 'cordova-plugin-geolocation',
+ pluginRef: 'navigator.geolocation'
+ }),
+ __metadata('design:paramtypes', [])
+ ], Geolocation);
+ return Geolocation;
+})();
+exports.Geolocation = Geolocation;
//# sourceMappingURL=geolocation.js.map
\ No newline at end of file
diff --git a/dist/src/plugins/geolocation.js.map b/dist/src/plugins/geolocation.js.map
index 9ee33d97c..8ad75cb69 100644
--- a/dist/src/plugins/geolocation.js.map
+++ b/dist/src/plugins/geolocation.js.map
@@ -1 +1 @@
-{"version":3,"file":"geolocation.js","sourceRoot":"","sources":["../../../src/plugins/geolocation.ts"],"names":["Geolocation","Geolocation.constructor","Geolocation.getCurrentPosition","Geolocation.watchPosition"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAMzC;IAAAA;IAgBAC,CAACA;IATQD,8BAAkBA,GADzBA,UAC0BA,OAAWA,IAAEE,CAACA;;IAQjCF,yBAAaA,GALpBA,UAKqBA,OAAWA,IAAEG,CAACA;;IATnCH;QAACA,gBAAOA,EAAEA;OACHA,iCAAkBA,QAAeA;IAGxCA;QAACA,gBAAOA,CAACA;YACPA,aAAaA,EAAEA,SAASA;YACxBA,UAAUA,EAAEA,IAAIA;YAChBA,aAAaA,EAAEA,cAAcA;SAC9BA,CAACA;OACKA,4BAAaA,QAAeA;IAfrCA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,aAAaA;YACnBA,MAAMA,EAAEA,4BAA4BA;YACpCA,SAASA,EAAEA,uBAAuBA;SACnCA,CAACA;oBAYDA;IAADA,kBAACA;AAADA,CAACA,AAhBD,IAgBC;AAXY,mBAAW,cAWvB,CAAA"}
\ No newline at end of file
+{"version":3,"file":"geolocation.js","sourceRoot":"","sources":["../../../src/plugins/geolocation.ts"],"names":["Geolocation","Geolocation.constructor","Geolocation.getCurrentPosition","Geolocation.watchPosition"],"mappings":";;;;;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAMzC;IAAAA;IAgBAC,CAACA;IATQD,8BAAkBA,GADzBA,UAC0BA,OAAWA,IAAEE,CAACA;;IAQjCF,yBAAaA,GALpBA,UAKqBA,OAAWA,IAAEG,CAACA;;IATnCH;QAACA,gBAAOA,EAAEA;;;;OACHA,iCAAkBA,QAAeA;IAGxCA;QAACA,gBAAOA,CAACA;YACPA,aAAaA,EAAEA,SAASA;YACxBA,UAAUA,EAAEA,IAAIA;YAChBA,aAAaA,EAAEA,cAAcA;SAC9BA,CAACA;;;;OACKA,4BAAaA,QAAeA;IAfrCA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,aAAaA;YACnBA,MAAMA,EAAEA,4BAA4BA;YACpCA,SAASA,EAAEA,uBAAuBA;SACnCA,CAACA;;oBAYDA;IAADA,kBAACA;AAADA,CAACA,AAhBD,IAgBC;AAXY,mBAAW,cAWvB,CAAA"}
\ No newline at end of file
diff --git a/dist/src/plugins/plugin.js b/dist/src/plugins/plugin.js
index f0faf9211..e02c61b57 100644
--- a/dist/src/plugins/plugin.js
+++ b/dist/src/plugins/plugin.js
@@ -56,9 +56,27 @@ function callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject) {
console.log('Cordova calling', pluginObj.name, methodName, args);
return util_1.get(window, pluginObj.pluginRef)[methodName].apply(pluginInstance, args);
}
+function getPromise(cb) {
+ if (window.Promise) {
+ console.log('Native promises available...');
+ return new Promise(function (resolve, reject) {
+ cb(resolve, reject);
+ });
+ }
+ else if (window.angular) {
+ var $q_1 = window.angular.injector(['ng']).get('$q');
+ console.log('Loaded $q', $q_1);
+ return $q_1(function (resolve, reject) {
+ cb(resolve, reject);
+ });
+ }
+ else {
+ console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 1/2 or on a recent browser.');
+ }
+}
function wrapPromise(pluginObj, methodName, args, opts) {
if (opts === void 0) { opts = {}; }
- return new Promise(function (resolve, reject) {
+ return getPromise(function (resolve, reject) {
callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
});
}
@@ -97,6 +115,9 @@ function Plugin(config) {
for (var k in config) {
cls[k] = config[k];
}
+ cls['installed'] = function () {
+ return !!exports.getPlugin(config.pluginRef);
+ };
return cls;
};
}
diff --git a/dist/src/plugins/plugin.js.map b/dist/src/plugins/plugin.js.map
index f8d3b8d8b..ba0ba4e5d 100644
--- a/dist/src/plugins/plugin.js.map
+++ b/dist/src/plugins/plugin.js.map
@@ -1 +1 @@
-{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/plugins/plugin.ts"],"names":["callCordovaPlugin","wrapPromise","wrapObservable","Plugin","Cordova","RequiresPlugin"],"mappings":"AAAA,qBAAkB,SAAS,CAAC,CAAA;AAK5B,mBAAyB,6BAA6B,CAAC,CAAA;AAG1C,iBAAS,GAAG,UAAS,SAAiB;IACjD,MAAM,CAAC,UAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAChC,CAAC,CAAA;AACY,mBAAW,GAAG,UAAS,SAAiB;IACnD,MAAM,CAAC,CAAC,CAAC,iBAAS,CAAC,SAAS,CAAC,CAAC;AAChC,CAAC,CAAA;AACY,kBAAU,GAAG,UAAS,UAAkB,EAAE,MAAc,EAAE,MAAc;IACnF,EAAE,CAAA,CAAC,MAAM,CAAC,CAAC,CAAC;QACV,OA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SAAS,EAAE,IAAI,CAAC,CAAC;QAC7B,EAAE,CAAA,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;YACnB,mBAAW,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAC7B,MAAM,CAAC;QACT,CAAC;QAED,IAAI,cAAc,GAAG,iBAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/C,EAAE,CAAA,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC;YACnB,kBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACvC,MAAM,CAAC;QACT,CAAC;QACD,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC,CAAAA;IAEDA,MAAMA,CAACA,UAAUA,CAACA;AACpBA,CAACA;AAnBe,sBAAc,iBAmB7B,CAAA"}
\ No newline at end of file
+{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/plugins/plugin.ts"],"names":["callCordovaPlugin","getPromise","wrapPromise","wrapObservable","Plugin","Cordova","RequiresPlugin"],"mappings":"AAAA,qBAAkB,SAAS,CAAC,CAAA;AAQ5B,mBAAyB,6BAA6B,CAAC,CAAA;AAG1C,iBAAS,GAAG,UAAS,SAAiB;IACjD,MAAM,CAAC,UAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAChC,CAAC,CAAA;AACY,mBAAW,GAAG,UAAS,SAAiB;IACnD,MAAM,CAAC,CAAC,CAAC,iBAAS,CAAC,SAAS,CAAC,CAAC;AAChC,CAAC,CAAA;AACY,kBAAU,GAAG,UAAS,UAAkB,EAAE,MAAc,EAAE,MAAc;IACnF,EAAE,CAAA,CAAC,MAAM,CAAC,CAAC,CAAC;QACV,OAAO,CAAC,IAAI,CAAC,wBAAwB,GAAG,UAAU,GAAG,GAAG,GAAG,MAAM;YAC/D,YAAY,GAAG,UAAU,GAAG,wCAAwC;Y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I,CAAC,CAAC;YACvC,MAAM,CAAC;QACT,CAAC;QACD,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC,CAAAA;IAEDA,MAAMA,CAACA,UAAUA,CAACA;AACpBA,CAACA;AAnBe,sBAAc,iBAmB7B,CAAA"}
\ No newline at end of file
diff --git a/ng1demo/.bowerrc b/ng1demo/.bowerrc
new file mode 100644
index 000000000..e28246d45
--- /dev/null
+++ b/ng1demo/.bowerrc
@@ -0,0 +1,3 @@
+{
+ "directory": "www/lib"
+}
diff --git a/ng1demo/.editorconfig b/ng1demo/.editorconfig
new file mode 100644
index 000000000..aca25232d
--- /dev/null
+++ b/ng1demo/.editorconfig
@@ -0,0 +1,14 @@
+# http://editorconfig.org
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 2
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.md]
+insert_final_newline = false
+trim_trailing_whitespace = false
\ No newline at end of file
diff --git a/ng1demo/.gitignore b/ng1demo/.gitignore
new file mode 100644
index 000000000..8f7ddd381
--- /dev/null
+++ b/ng1demo/.gitignore
@@ -0,0 +1,6 @@
+# Specifies intentionally untracked files to ignore when using Git
+# http://git-scm.com/docs/gitignore
+
+node_modules/
+platforms/
+plugins/
diff --git a/ng1demo/bower.json b/ng1demo/bower.json
new file mode 100644
index 000000000..14165dcab
--- /dev/null
+++ b/ng1demo/bower.json
@@ -0,0 +1,7 @@
+{
+ "name": "HelloIonic",
+ "private": "true",
+ "devDependencies": {
+ "ionic": "driftyco/ionic-bower#1.1.1"
+ }
+}
diff --git a/ng1demo/config.xml b/ng1demo/config.xml
new file mode 100644
index 000000000..3841e773b
--- /dev/null
+++ b/ng1demo/config.xml
@@ -0,0 +1,20 @@
+
+
+ * $resolve.study(invocables)(locals, parent, self) + *+ * is equivalent to + *
+ * $resolve.resolve(invocables, locals, parent, self) + *+ * but the former is more efficient (in fact `resolve` just calls `study` + * internally). + * + * @param {object} invocables Invocable objects + * @return {function} a function to pass in locals, parent and self + */ + this.study = function (invocables) { + if (!isObject(invocables)) throw new Error("'invocables' must be an object"); + var invocableKeys = objectKeys(invocables || {}); + + // Perform a topological sort of invocables to build an ordered plan + var plan = [], cycle = [], visited = {}; + function visit(value, key) { + if (visited[key] === VISIT_DONE) return; + + cycle.push(key); + if (visited[key] === VISIT_IN_PROGRESS) { + cycle.splice(0, indexOf(cycle, key)); + throw new Error("Cyclic dependency: " + cycle.join(" -> ")); + } + visited[key] = VISIT_IN_PROGRESS; + + if (isString(value)) { + plan.push(key, [ function() { return $injector.get(value); }], NO_DEPENDENCIES); + } else { + var params = $injector.annotate(value); + forEach(params, function (param) { + if (param !== key && invocables.hasOwnProperty(param)) visit(invocables[param], param); + }); + plan.push(key, value, params); + } + + cycle.pop(); + visited[key] = VISIT_DONE; + } + forEach(invocables, visit); + invocables = cycle = visited = null; // plan is all that's required + + function isResolve(value) { + return isObject(value) && value.then && value.$$promises; + } + + return function (locals, parent, self) { + if (isResolve(locals) && self === undefined) { + self = parent; parent = locals; locals = null; + } + if (!locals) locals = NO_LOCALS; + else if (!isObject(locals)) { + throw new Error("'locals' must be an object"); + } + if (!parent) parent = NO_PARENT; + else if (!isResolve(parent)) { + throw new Error("'parent' must be a promise returned by $resolve.resolve()"); + } + + // To complete the overall resolution, we have to wait for the parent + // promise and for the promise for each invokable in our plan. + var resolution = $q.defer(), + result = resolution.promise, + promises = result.$$promises = {}, + values = extend({}, locals), + wait = 1 + plan.length/3, + merged = false; + + function done() { + // Merge parent values we haven't got yet and publish our own $$values + if (!--wait) { + if (!merged) merge(values, parent.$$values); + result.$$values = values; + result.$$promises = result.$$promises || true; // keep for isResolve() + delete result.$$inheritedValues; + resolution.resolve(values); + } + } + + function fail(reason) { + result.$$failure = reason; + resolution.reject(reason); + } + + // Short-circuit if parent has already failed + if (isDefined(parent.$$failure)) { + fail(parent.$$failure); + return result; + } + + if (parent.$$inheritedValues) { + merge(values, omit(parent.$$inheritedValues, invocableKeys)); + } + + // Merge parent values if the parent has already resolved, or merge + // parent promises and wait if the parent resolve is still in progress. + extend(promises, parent.$$promises); + if (parent.$$values) { + merged = merge(values, omit(parent.$$values, invocableKeys)); + result.$$inheritedValues = omit(parent.$$values, invocableKeys); + done(); + } else { + if (parent.$$inheritedValues) { + result.$$inheritedValues = omit(parent.$$inheritedValues, invocableKeys); + } + parent.then(done, fail); + } + + // Process each invocable in the plan, but ignore any where a local of the same name exists. + for (var i=0, ii=plan.length; i
+ * new UrlMatcher('/user/{id}?q').concat('/details?date'); + * new UrlMatcher('/user/{id}/details?q&date'); + *+ * + * @param {string} pattern The pattern to append. + * @param {Object} config An object hash of the configuration for the matcher. + * @returns {UrlMatcher} A matcher for the concatenated pattern. + */ +UrlMatcher.prototype.concat = function (pattern, config) { + // Because order of search parameters is irrelevant, we can add our own search + // parameters to the end of the new pattern. Parse the new pattern by itself + // and then join the bits together, but it's much easier to do this on a string level. + var defaultConfig = { + caseInsensitive: $$UMFP.caseInsensitive(), + strict: $$UMFP.strictMode(), + squash: $$UMFP.defaultSquashPolicy() + }; + return new UrlMatcher(this.sourcePath + pattern + this.sourceSearch, extend(defaultConfig, config), this); +}; + +UrlMatcher.prototype.toString = function () { + return this.source; +}; + +/** + * @ngdoc function + * @name ui.router.util.type:UrlMatcher#exec + * @methodOf ui.router.util.type:UrlMatcher + * + * @description + * Tests the specified path against this matcher, and returns an object containing the captured + * parameter values, or null if the path does not match. The returned object contains the values + * of any search parameters that are mentioned in the pattern, but their value may be null if + * they are not present in `searchParams`. This means that search parameters are always treated + * as optional. + * + * @example + *
+ * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', { + * x: '1', q: 'hello' + * }); + * // returns { id: 'bob', q: 'hello', r: null } + *+ * + * @param {string} path The URL path to match, e.g. `$location.path()`. + * @param {Object} searchParams URL search parameters, e.g. `$location.search()`. + * @returns {Object} The captured parameter values. + */ +UrlMatcher.prototype.exec = function (path, searchParams) { + var m = this.regexp.exec(path); + if (!m) return null; + searchParams = searchParams || {}; + + var paramNames = this.parameters(), nTotal = paramNames.length, + nPath = this.segments.length - 1, + values = {}, i, j, cfg, paramName; + + if (nPath !== m.length - 1) throw new Error("Unbalanced capture group in route '" + this.source + "'"); + + function decodePathArray(string) { + function reverseString(str) { return str.split("").reverse().join(""); } + function unquoteDashes(str) { return str.replace(/\\-/, "-"); } + + var split = reverseString(string).split(/-(?!\\)/); + var allReversed = map(split, reverseString); + return map(allReversed, unquoteDashes).reverse(); + } + + for (i = 0; i < nPath; i++) { + paramName = paramNames[i]; + var param = this.params[paramName]; + var paramVal = m[i+1]; + // if the param value matches a pre-replace pair, replace the value before decoding. + for (j = 0; j < param.replace; j++) { + if (param.replace[j].from === paramVal) paramVal = param.replace[j].to; + } + if (paramVal && param.array === true) paramVal = decodePathArray(paramVal); + values[paramName] = param.value(paramVal); + } + for (/**/; i < nTotal; i++) { + paramName = paramNames[i]; + values[paramName] = this.params[paramName].value(searchParams[paramName]); + } + + return values; +}; + +/** + * @ngdoc function + * @name ui.router.util.type:UrlMatcher#parameters + * @methodOf ui.router.util.type:UrlMatcher + * + * @description + * Returns the names of all path and search parameters of this pattern in an unspecified order. + * + * @returns {Array.
+ * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' }); + * // returns '/user/bob?q=yes' + *+ * + * @param {Object} values the values to substitute for the parameters in this pattern. + * @returns {string} the formatted URL (path and optionally search part). + */ +UrlMatcher.prototype.format = function (values) { + values = values || {}; + var segments = this.segments, params = this.parameters(), paramset = this.params; + if (!this.validates(values)) return null; + + var i, search = false, nPath = segments.length - 1, nTotal = params.length, result = segments[0]; + + function encodeDashes(str) { // Replace dashes with encoded "\-" + return encodeURIComponent(str).replace(/-/g, function(c) { return '%5C%' + c.charCodeAt(0).toString(16).toUpperCase(); }); + } + + for (i = 0; i < nTotal; i++) { + var isPathParam = i < nPath; + var name = params[i], param = paramset[name], value = param.value(values[name]); + var isDefaultValue = param.isOptional && param.type.equals(param.value(), value); + var squash = isDefaultValue ? param.squash : false; + var encoded = param.type.encode(value); + + if (isPathParam) { + var nextSegment = segments[i + 1]; + if (squash === false) { + if (encoded != null) { + if (isArray(encoded)) { + result += map(encoded, encodeDashes).join("-"); + } else { + result += encodeURIComponent(encoded); + } + } + result += nextSegment; + } else if (squash === true) { + var capture = result.match(/\/$/) ? /\/?(.*)/ : /(.*)/; + result += nextSegment.match(capture)[1]; + } else if (isString(squash)) { + result += squash + nextSegment; + } + } else { + if (encoded == null || (isDefaultValue && squash !== false)) continue; + if (!isArray(encoded)) encoded = [ encoded ]; + encoded = map(encoded, encodeURIComponent).join('&' + name + '='); + result += (search ? '&' : '?') + (name + '=' + encoded); + search = true; + } + } + + return result; +}; + +/** + * @ngdoc object + * @name ui.router.util.type:Type + * + * @description + * Implements an interface to define custom parameter types that can be decoded from and encoded to + * string parameters matched in a URL. Used by {@link ui.router.util.type:UrlMatcher `UrlMatcher`} + * objects when matching or formatting URLs, or comparing or validating parameter values. + * + * See {@link ui.router.util.$urlMatcherFactory#methods_type `$urlMatcherFactory#type()`} for more + * information on registering custom types. + * + * @param {Object} config A configuration object which contains the custom type definition. The object's + * properties will override the default methods and/or pattern in `Type`'s public interface. + * @example + *
+ * { + * decode: function(val) { return parseInt(val, 10); }, + * encode: function(val) { return val && val.toString(); }, + * equals: function(a, b) { return this.is(a) && a === b; }, + * is: function(val) { return angular.isNumber(val) isFinite(val) && val % 1 === 0; }, + * pattern: /\d+/ + * } + *+ * + * @property {RegExp} pattern The regular expression pattern used to match values of this type when + * coming from a substring of a URL. + * + * @returns {Object} Returns a new `Type` object. + */ +function Type(config) { + extend(this, config); +} + +/** + * @ngdoc function + * @name ui.router.util.type:Type#is + * @methodOf ui.router.util.type:Type + * + * @description + * Detects whether a value is of a particular type. Accepts a native (decoded) value + * and determines whether it matches the current `Type` object. + * + * @param {*} val The value to check. + * @param {string} key Optional. If the type check is happening in the context of a specific + * {@link ui.router.util.type:UrlMatcher `UrlMatcher`} object, this is the name of the + * parameter in which `val` is stored. Can be used for meta-programming of `Type` objects. + * @returns {Boolean} Returns `true` if the value matches the type, otherwise `false`. + */ +Type.prototype.is = function(val, key) { + return true; +}; + +/** + * @ngdoc function + * @name ui.router.util.type:Type#encode + * @methodOf ui.router.util.type:Type + * + * @description + * Encodes a custom/native type value to a string that can be embedded in a URL. Note that the + * return value does *not* need to be URL-safe (i.e. passed through `encodeURIComponent()`), it + * only needs to be a representation of `val` that has been coerced to a string. + * + * @param {*} val The value to encode. + * @param {string} key The name of the parameter in which `val` is stored. Can be used for + * meta-programming of `Type` objects. + * @returns {string} Returns a string representation of `val` that can be encoded in a URL. + */ +Type.prototype.encode = function(val, key) { + return val; +}; + +/** + * @ngdoc function + * @name ui.router.util.type:Type#decode + * @methodOf ui.router.util.type:Type + * + * @description + * Converts a parameter value (from URL string or transition param) to a custom/native value. + * + * @param {string} val The URL parameter value to decode. + * @param {string} key The name of the parameter in which `val` is stored. Can be used for + * meta-programming of `Type` objects. + * @returns {*} Returns a custom representation of the URL parameter value. + */ +Type.prototype.decode = function(val, key) { + return val; +}; + +/** + * @ngdoc function + * @name ui.router.util.type:Type#equals + * @methodOf ui.router.util.type:Type + * + * @description + * Determines whether two decoded values are equivalent. + * + * @param {*} a A value to compare against. + * @param {*} b A value to compare against. + * @returns {Boolean} Returns `true` if the values are equivalent/equal, otherwise `false`. + */ +Type.prototype.equals = function(a, b) { + return a == b; +}; + +Type.prototype.$subPattern = function() { + var sub = this.pattern.toString(); + return sub.substr(1, sub.length - 2); +}; + +Type.prototype.pattern = /.*/; + +Type.prototype.toString = function() { return "{Type:" + this.name + "}"; }; + +/* + * Wraps an existing custom Type as an array of Type, depending on 'mode'. + * e.g.: + * - urlmatcher pattern "/path?{queryParam[]:int}" + * - url: "/path?queryParam=1&queryParam=2 + * - $stateParams.queryParam will be [1, 2] + * if `mode` is "auto", then + * - url: "/path?queryParam=1 will create $stateParams.queryParam: 1 + * - url: "/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2] + */ +Type.prototype.$asArray = function(mode, isSearch) { + if (!mode) return this; + if (mode === "auto" && !isSearch) throw new Error("'auto' array mode is for query parameters only"); + return new ArrayType(this, mode); + + function ArrayType(type, mode) { + function bindTo(type, callbackName) { + return function() { + return type[callbackName].apply(type, arguments); + }; + } + + // Wrap non-array value as array + function arrayWrap(val) { return isArray(val) ? val : (isDefined(val) ? [ val ] : []); } + // Unwrap array value for "auto" mode. Return undefined for empty array. + function arrayUnwrap(val) { + switch(val.length) { + case 0: return undefined; + case 1: return mode === "auto" ? val[0] : val; + default: return val; + } + } + function falsey(val) { return !val; } + + // Wraps type (.is/.encode/.decode) functions to operate on each value of an array + function arrayHandler(callback, allTruthyMode) { + return function handleArray(val) { + val = arrayWrap(val); + var result = map(val, callback); + if (allTruthyMode === true) + return filter(result, falsey).length === 0; + return arrayUnwrap(result); + }; + } + + // Wraps type (.equals) functions to operate on each value of an array + function arrayEqualsHandler(callback) { + return function handleArray(val1, val2) { + var left = arrayWrap(val1), right = arrayWrap(val2); + if (left.length !== right.length) return false; + for (var i = 0; i < left.length; i++) { + if (!callback(left[i], right[i])) return false; + } + return true; + }; + } + + this.encode = arrayHandler(bindTo(type, 'encode')); + this.decode = arrayHandler(bindTo(type, 'decode')); + this.is = arrayHandler(bindTo(type, 'is'), true); + this.equals = arrayEqualsHandler(bindTo(type, 'equals')); + this.pattern = type.pattern; + this.$arrayMode = mode; + } +}; + + + +/** + * @ngdoc object + * @name ui.router.util.$urlMatcherFactory + * + * @description + * Factory for {@link ui.router.util.type:UrlMatcher `UrlMatcher`} instances. The factory + * is also available to providers under the name `$urlMatcherFactoryProvider`. + */ +function $UrlMatcherFactory() { + $$UMFP = this; + + var isCaseInsensitive = false, isStrictMode = true, defaultSquashPolicy = false; + + function valToString(val) { return val != null ? val.toString().replace(/\//g, "%2F") : val; } + function valFromString(val) { return val != null ? val.toString().replace(/%2F/g, "/") : val; } +// TODO: in 1.0, make string .is() return false if value is undefined by default. +// function regexpMatches(val) { /*jshint validthis:true */ return isDefined(val) && this.pattern.test(val); } + function regexpMatches(val) { /*jshint validthis:true */ return this.pattern.test(val); } + + var $types = {}, enqueue = true, typeQueue = [], injector, defaultTypes = { + string: { + encode: valToString, + decode: valFromString, + is: regexpMatches, + pattern: /[^/]*/ + }, + int: { + encode: valToString, + decode: function(val) { return parseInt(val, 10); }, + is: function(val) { return isDefined(val) && this.decode(val.toString()) === val; }, + pattern: /\d+/ + }, + bool: { + encode: function(val) { return val ? 1 : 0; }, + decode: function(val) { return parseInt(val, 10) !== 0; }, + is: function(val) { return val === true || val === false; }, + pattern: /0|1/ + }, + date: { + encode: function (val) { + if (!this.is(val)) + return undefined; + return [ val.getFullYear(), + ('0' + (val.getMonth() + 1)).slice(-2), + ('0' + val.getDate()).slice(-2) + ].join("-"); + }, + decode: function (val) { + if (this.is(val)) return val; + var match = this.capture.exec(val); + return match ? new Date(match[1], match[2] - 1, match[3]) : undefined; + }, + is: function(val) { return val instanceof Date && !isNaN(val.valueOf()); }, + equals: function (a, b) { return this.is(a) && this.is(b) && a.toISOString() === b.toISOString(); }, + pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/, + capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/ + }, + json: { + encode: angular.toJson, + decode: angular.fromJson, + is: angular.isObject, + equals: angular.equals, + pattern: /[^/]*/ + }, + any: { // does not encode/decode + encode: angular.identity, + decode: angular.identity, + is: angular.identity, + equals: angular.equals, + pattern: /.*/ + } + }; + + function getDefaultConfig() { + return { + strict: isStrictMode, + caseInsensitive: isCaseInsensitive + }; + } + + function isInjectable(value) { + return (isFunction(value) || (isArray(value) && isFunction(value[value.length - 1]))); + } + + /** + * [Internal] Get the default value of a parameter, which may be an injectable function. + */ + $UrlMatcherFactory.$$getDefaultValue = function(config) { + if (!isInjectable(config.value)) return config.value; + if (!injector) throw new Error("Injectable functions cannot be called at configuration time"); + return injector.invoke(config.value); + }; + + /** + * @ngdoc function + * @name ui.router.util.$urlMatcherFactory#caseInsensitive + * @methodOf ui.router.util.$urlMatcherFactory + * + * @description + * Defines whether URL matching should be case sensitive (the default behavior), or not. + * + * @param {boolean} value `false` to match URL in a case sensitive manner; otherwise `true`; + * @returns {boolean} the current value of caseInsensitive + */ + this.caseInsensitive = function(value) { + if (isDefined(value)) + isCaseInsensitive = value; + return isCaseInsensitive; + }; + + /** + * @ngdoc function + * @name ui.router.util.$urlMatcherFactory#strictMode + * @methodOf ui.router.util.$urlMatcherFactory + * + * @description + * Defines whether URLs should match trailing slashes, or not (the default behavior). + * + * @param {boolean=} value `false` to match trailing slashes in URLs, otherwise `true`. + * @returns {boolean} the current value of strictMode + */ + this.strictMode = function(value) { + if (isDefined(value)) + isStrictMode = value; + return isStrictMode; + }; + + /** + * @ngdoc function + * @name ui.router.util.$urlMatcherFactory#defaultSquashPolicy + * @methodOf ui.router.util.$urlMatcherFactory + * + * @description + * Sets the default behavior when generating or matching URLs with default parameter values. + * + * @param {string} value A string that defines the default parameter URL squashing behavior. + * `nosquash`: When generating an href with a default parameter value, do not squash the parameter value from the URL + * `slash`: When generating an href with a default parameter value, squash (remove) the parameter value, and, if the + * parameter is surrounded by slashes, squash (remove) one slash from the URL + * any other string, e.g. "~": When generating an href with a default parameter value, squash (remove) + * the parameter value from the URL and replace it with this string. + */ + this.defaultSquashPolicy = function(value) { + if (!isDefined(value)) return defaultSquashPolicy; + if (value !== true && value !== false && !isString(value)) + throw new Error("Invalid squash policy: " + value + ". Valid policies: false, true, arbitrary-string"); + defaultSquashPolicy = value; + return value; + }; + + /** + * @ngdoc function + * @name ui.router.util.$urlMatcherFactory#compile + * @methodOf ui.router.util.$urlMatcherFactory + * + * @description + * Creates a {@link ui.router.util.type:UrlMatcher `UrlMatcher`} for the specified pattern. + * + * @param {string} pattern The URL pattern. + * @param {Object} config The config object hash. + * @returns {UrlMatcher} The UrlMatcher. + */ + this.compile = function (pattern, config) { + return new UrlMatcher(pattern, extend(getDefaultConfig(), config)); + }; + + /** + * @ngdoc function + * @name ui.router.util.$urlMatcherFactory#isMatcher + * @methodOf ui.router.util.$urlMatcherFactory + * + * @description + * Returns true if the specified object is a `UrlMatcher`, or false otherwise. + * + * @param {Object} object The object to perform the type check against. + * @returns {Boolean} Returns `true` if the object matches the `UrlMatcher` interface, by + * implementing all the same methods. + */ + this.isMatcher = function (o) { + if (!isObject(o)) return false; + var result = true; + + forEach(UrlMatcher.prototype, function(val, name) { + if (isFunction(val)) { + result = result && (isDefined(o[name]) && isFunction(o[name])); + } + }); + return result; + }; + + /** + * @ngdoc function + * @name ui.router.util.$urlMatcherFactory#type + * @methodOf ui.router.util.$urlMatcherFactory + * + * @description + * Registers a custom {@link ui.router.util.type:Type `Type`} object that can be used to + * generate URLs with typed parameters. + * + * @param {string} name The type name. + * @param {Object|Function} definition The type definition. See + * {@link ui.router.util.type:Type `Type`} for information on the values accepted. + * @param {Object|Function} definitionFn (optional) A function that is injected before the app + * runtime starts. The result of this function is merged into the existing `definition`. + * See {@link ui.router.util.type:Type `Type`} for information on the values accepted. + * + * @returns {Object} Returns `$urlMatcherFactoryProvider`. + * + * @example + * This is a simple example of a custom type that encodes and decodes items from an + * array, using the array index as the URL-encoded value: + * + *
+ * var list = ['John', 'Paul', 'George', 'Ringo']; + * + * $urlMatcherFactoryProvider.type('listItem', { + * encode: function(item) { + * // Represent the list item in the URL using its corresponding index + * return list.indexOf(item); + * }, + * decode: function(item) { + * // Look up the list item by index + * return list[parseInt(item, 10)]; + * }, + * is: function(item) { + * // Ensure the item is valid by checking to see that it appears + * // in the list + * return list.indexOf(item) > -1; + * } + * }); + * + * $stateProvider.state('list', { + * url: "/list/{item:listItem}", + * controller: function($scope, $stateParams) { + * console.log($stateParams.item); + * } + * }); + * + * // ... + * + * // Changes URL to '/list/3', logs "Ringo" to the console + * $state.go('list', { item: "Ringo" }); + *+ * + * This is a more complex example of a type that relies on dependency injection to + * interact with services, and uses the parameter name from the URL to infer how to + * handle encoding and decoding parameter values: + * + *
+ * // Defines a custom type that gets a value from a service, + * // where each service gets different types of values from + * // a backend API: + * $urlMatcherFactoryProvider.type('dbObject', {}, function(Users, Posts) { + * + * // Matches up services to URL parameter names + * var services = { + * user: Users, + * post: Posts + * }; + * + * return { + * encode: function(object) { + * // Represent the object in the URL using its unique ID + * return object.id; + * }, + * decode: function(value, key) { + * // Look up the object by ID, using the parameter + * // name (key) to call the correct service + * return services[key].findById(value); + * }, + * is: function(object, key) { + * // Check that object is a valid dbObject + * return angular.isObject(object) && object.id && services[key]; + * } + * equals: function(a, b) { + * // Check the equality of decoded objects by comparing + * // their unique IDs + * return a.id === b.id; + * } + * }; + * }); + * + * // In a config() block, you can then attach URLs with + * // type-annotated parameters: + * $stateProvider.state('users', { + * url: "/users", + * // ... + * }).state('users.item', { + * url: "/{user:dbObject}", + * controller: function($scope, $stateParams) { + * // $stateParams.user will now be an object returned from + * // the Users service + * }, + * // ... + * }); + *+ */ + this.type = function (name, definition, definitionFn) { + if (!isDefined(definition)) return $types[name]; + if ($types.hasOwnProperty(name)) throw new Error("A type named '" + name + "' has already been defined."); + + $types[name] = new Type(extend({ name: name }, definition)); + if (definitionFn) { + typeQueue.push({ name: name, def: definitionFn }); + if (!enqueue) flushTypeQueue(); + } + return this; + }; + + // `flushTypeQueue()` waits until `$urlMatcherFactory` is injected before invoking the queued `definitionFn`s + function flushTypeQueue() { + while(typeQueue.length) { + var type = typeQueue.shift(); + if (type.pattern) throw new Error("You cannot override a type's .pattern at runtime."); + angular.extend($types[type.name], injector.invoke(type.def)); + } + } + + // Register default types. Store them in the prototype of $types. + forEach(defaultTypes, function(type, name) { $types[name] = new Type(extend({name: name}, type)); }); + $types = inherit($types, {}); + + /* No need to document $get, since it returns this */ + this.$get = ['$injector', function ($injector) { + injector = $injector; + enqueue = false; + flushTypeQueue(); + + forEach(defaultTypes, function(type, name) { + if (!$types[name]) $types[name] = new Type(type); + }); + return this; + }]; + + this.Param = function Param(id, type, config, location) { + var self = this; + config = unwrapShorthand(config); + type = getType(config, type, location); + var arrayMode = getArrayMode(); + type = arrayMode ? type.$asArray(arrayMode, location === "search") : type; + if (type.name === "string" && !arrayMode && location === "path" && config.value === undefined) + config.value = ""; // for 0.2.x; in 0.3.0+ do not automatically default to "" + var isOptional = config.value !== undefined; + var squash = getSquashPolicy(config, isOptional); + var replace = getReplace(config, arrayMode, isOptional, squash); + + function unwrapShorthand(config) { + var keys = isObject(config) ? objectKeys(config) : []; + var isShorthand = indexOf(keys, "value") === -1 && indexOf(keys, "type") === -1 && + indexOf(keys, "squash") === -1 && indexOf(keys, "array") === -1; + if (isShorthand) config = { value: config }; + config.$$fn = isInjectable(config.value) ? config.value : function () { return config.value; }; + return config; + } + + function getType(config, urlType, location) { + if (config.type && urlType) throw new Error("Param '"+id+"' has two type configurations."); + if (urlType) return urlType; + if (!config.type) return (location === "config" ? $types.any : $types.string); + return config.type instanceof Type ? config.type : new Type(config.type); + } + + // array config: param name (param[]) overrides default settings. explicit config overrides param name. + function getArrayMode() { + var arrayDefaults = { array: (location === "search" ? "auto" : false) }; + var arrayParamNomenclature = id.match(/\[\]$/) ? { array: true } : {}; + return extend(arrayDefaults, arrayParamNomenclature, config).array; + } + + /** + * returns false, true, or the squash value to indicate the "default parameter url squash policy". + */ + function getSquashPolicy(config, isOptional) { + var squash = config.squash; + if (!isOptional || squash === false) return false; + if (!isDefined(squash) || squash == null) return defaultSquashPolicy; + if (squash === true || isString(squash)) return squash; + throw new Error("Invalid squash policy: '" + squash + "'. Valid policies: false, true, or arbitrary string"); + } + + function getReplace(config, arrayMode, isOptional, squash) { + var replace, configuredKeys, defaultPolicy = [ + { from: "", to: (isOptional || arrayMode ? undefined : "") }, + { from: null, to: (isOptional || arrayMode ? undefined : "") } + ]; + replace = isArray(config.replace) ? config.replace : []; + if (isString(squash)) + replace.push({ from: squash, to: undefined }); + configuredKeys = map(replace, function(item) { return item.from; } ); + return filter(defaultPolicy, function(item) { return indexOf(configuredKeys, item.from) === -1; }).concat(replace); + } + + /** + * [Internal] Get the default value of a parameter, which may be an injectable function. + */ + function $$getDefaultValue() { + if (!injector) throw new Error("Injectable functions cannot be called at configuration time"); + return injector.invoke(config.$$fn); + } + + /** + * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the + * default value, which may be the result of an injectable function. + */ + function $value(value) { + function hasReplaceVal(val) { return function(obj) { return obj.from === val; }; } + function $replace(value) { + var replacement = map(filter(self.replace, hasReplaceVal(value)), function(obj) { return obj.to; }); + return replacement.length ? replacement[0] : value; + } + value = $replace(value); + return isDefined(value) ? self.type.decode(value) : $$getDefaultValue(); + } + + function toString() { return "{Param:" + id + " " + type + " squash: '" + squash + "' optional: " + isOptional + "}"; } + + extend(this, { + id: id, + type: type, + location: location, + array: arrayMode, + squash: squash, + replace: replace, + isOptional: isOptional, + value: $value, + dynamic: undefined, + config: config, + toString: toString + }); + }; + + function ParamSet(params) { + extend(this, params || {}); + } + + ParamSet.prototype = { + $$new: function() { + return inherit(this, extend(new ParamSet(), { $$parent: this})); + }, + $$keys: function () { + var keys = [], chain = [], parent = this, + ignore = objectKeys(ParamSet.prototype); + while (parent) { chain.push(parent); parent = parent.$$parent; } + chain.reverse(); + forEach(chain, function(paramset) { + forEach(objectKeys(paramset), function(key) { + if (indexOf(keys, key) === -1 && indexOf(ignore, key) === -1) keys.push(key); + }); + }); + return keys; + }, + $$values: function(paramValues) { + var values = {}, self = this; + forEach(self.$$keys(), function(key) { + values[key] = self[key].value(paramValues && paramValues[key]); + }); + return values; + }, + $$equals: function(paramValues1, paramValues2) { + var equal = true, self = this; + forEach(self.$$keys(), function(key) { + var left = paramValues1 && paramValues1[key], right = paramValues2 && paramValues2[key]; + if (!self[key].type.equals(left, right)) equal = false; + }); + return equal; + }, + $$validates: function $$validate(paramValues) { + var result = true, isOptional, val, param, self = this; + + forEach(this.$$keys(), function(key) { + param = self[key]; + val = paramValues[key]; + isOptional = !val && param.isOptional; + result = result && (isOptional || !!param.type.is(val)); + }); + return result; + }, + $$parent: undefined + }; + + this.ParamSet = ParamSet; +} + +// Register as a provider so it's available to other providers +angular.module('ui.router.util').provider('$urlMatcherFactory', $UrlMatcherFactory); +angular.module('ui.router.util').run(['$urlMatcherFactory', function($urlMatcherFactory) { }]); + +/** + * @ngdoc object + * @name ui.router.router.$urlRouterProvider + * + * @requires ui.router.util.$urlMatcherFactoryProvider + * @requires $locationProvider + * + * @description + * `$urlRouterProvider` has the responsibility of watching `$location`. + * When `$location` changes it runs through a list of rules one by one until a + * match is found. `$urlRouterProvider` is used behind the scenes anytime you specify + * a url in a state configuration. All urls are compiled into a UrlMatcher object. + * + * There are several methods on `$urlRouterProvider` that make it useful to use directly + * in your module config. + */ +$UrlRouterProvider.$inject = ['$locationProvider', '$urlMatcherFactoryProvider']; +function $UrlRouterProvider( $locationProvider, $urlMatcherFactory) { + var rules = [], otherwise = null, interceptDeferred = false, listener; + + // Returns a string that is a prefix of all strings matching the RegExp + function regExpPrefix(re) { + var prefix = /^\^((?:\\[^a-zA-Z0-9]|[^\\\[\]\^$*+?.()|{}]+)*)/.exec(re.source); + return (prefix != null) ? prefix[1].replace(/\\(.)/g, "$1") : ''; + } + + // Interpolates matched values into a String.replace()-style pattern + function interpolate(pattern, match) { + return pattern.replace(/\$(\$|\d{1,2})/, function (m, what) { + return match[what === '$' ? 0 : Number(what)]; + }); + } + + /** + * @ngdoc function + * @name ui.router.router.$urlRouterProvider#rule + * @methodOf ui.router.router.$urlRouterProvider + * + * @description + * Defines rules that are used by `$urlRouterProvider` to find matches for + * specific URLs. + * + * @example + *
+ * var app = angular.module('app', ['ui.router.router']); + * + * app.config(function ($urlRouterProvider) { + * // Here's an example of how you might allow case insensitive urls + * $urlRouterProvider.rule(function ($injector, $location) { + * var path = $location.path(), + * normalized = path.toLowerCase(); + * + * if (path !== normalized) { + * return normalized; + * } + * }); + * }); + *+ * + * @param {object} rule Handler function that takes `$injector` and `$location` + * services as arguments. You can use them to return a valid path as a string. + * + * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance + */ + this.rule = function (rule) { + if (!isFunction(rule)) throw new Error("'rule' must be a function"); + rules.push(rule); + return this; + }; + + /** + * @ngdoc object + * @name ui.router.router.$urlRouterProvider#otherwise + * @methodOf ui.router.router.$urlRouterProvider + * + * @description + * Defines a path that is used when an invalid route is requested. + * + * @example + *
+ * var app = angular.module('app', ['ui.router.router']); + * + * app.config(function ($urlRouterProvider) { + * // if the path doesn't match any of the urls you configured + * // otherwise will take care of routing the user to the + * // specified url + * $urlRouterProvider.otherwise('/index'); + * + * // Example of using function rule as param + * $urlRouterProvider.otherwise(function ($injector, $location) { + * return '/a/valid/url'; + * }); + * }); + *+ * + * @param {string|object} rule The url path you want to redirect to or a function + * rule that returns the url path. The function version is passed two params: + * `$injector` and `$location` services, and must return a url string. + * + * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance + */ + this.otherwise = function (rule) { + if (isString(rule)) { + var redirect = rule; + rule = function () { return redirect; }; + } + else if (!isFunction(rule)) throw new Error("'rule' must be a function"); + otherwise = rule; + return this; + }; + + + function handleIfMatch($injector, handler, match) { + if (!match) return false; + var result = $injector.invoke(handler, handler, { $match: match }); + return isDefined(result) ? result : true; + } + + /** + * @ngdoc function + * @name ui.router.router.$urlRouterProvider#when + * @methodOf ui.router.router.$urlRouterProvider + * + * @description + * Registers a handler for a given url matching. if handle is a string, it is + * treated as a redirect, and is interpolated according to the syntax of match + * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise). + * + * If the handler is a function, it is injectable. It gets invoked if `$location` + * matches. You have the option of inject the match object as `$match`. + * + * The handler can return + * + * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter` + * will continue trying to find another one that matches. + * - **string** which is treated as a redirect and passed to `$location.url()` + * - **void** or any **truthy** value tells `$urlRouter` that the url was handled. + * + * @example + *
+ * var app = angular.module('app', ['ui.router.router']); + * + * app.config(function ($urlRouterProvider) { + * $urlRouterProvider.when($state.url, function ($match, $stateParams) { + * if ($state.$current.navigable !== state || + * !equalForKeys($match, $stateParams) { + * $state.transitionTo(state, $match, false); + * } + * }); + * }); + *+ * + * @param {string|object} what The incoming path that you want to redirect. + * @param {string|object} handler The path you want to redirect your user to. + */ + this.when = function (what, handler) { + var redirect, handlerIsString = isString(handler); + if (isString(what)) what = $urlMatcherFactory.compile(what); + + if (!handlerIsString && !isFunction(handler) && !isArray(handler)) + throw new Error("invalid 'handler' in when()"); + + var strategies = { + matcher: function (what, handler) { + if (handlerIsString) { + redirect = $urlMatcherFactory.compile(handler); + handler = ['$match', function ($match) { return redirect.format($match); }]; + } + return extend(function ($injector, $location) { + return handleIfMatch($injector, handler, what.exec($location.path(), $location.search())); + }, { + prefix: isString(what.prefix) ? what.prefix : '' + }); + }, + regex: function (what, handler) { + if (what.global || what.sticky) throw new Error("when() RegExp must not be global or sticky"); + + if (handlerIsString) { + redirect = handler; + handler = ['$match', function ($match) { return interpolate(redirect, $match); }]; + } + return extend(function ($injector, $location) { + return handleIfMatch($injector, handler, what.exec($location.path())); + }, { + prefix: regExpPrefix(what) + }); + } + }; + + var check = { matcher: $urlMatcherFactory.isMatcher(what), regex: what instanceof RegExp }; + + for (var n in check) { + if (check[n]) return this.rule(strategies[n](what, handler)); + } + + throw new Error("invalid 'what' in when()"); + }; + + /** + * @ngdoc function + * @name ui.router.router.$urlRouterProvider#deferIntercept + * @methodOf ui.router.router.$urlRouterProvider + * + * @description + * Disables (or enables) deferring location change interception. + * + * If you wish to customize the behavior of syncing the URL (for example, if you wish to + * defer a transition but maintain the current URL), call this method at configuration time. + * Then, at run time, call `$urlRouter.listen()` after you have configured your own + * `$locationChangeSuccess` event handler. + * + * @example + *
+ * var app = angular.module('app', ['ui.router.router']); + * + * app.config(function ($urlRouterProvider) { + * + * // Prevent $urlRouter from automatically intercepting URL changes; + * // this allows you to configure custom behavior in between + * // location changes and route synchronization: + * $urlRouterProvider.deferIntercept(); + * + * }).run(function ($rootScope, $urlRouter, UserService) { + * + * $rootScope.$on('$locationChangeSuccess', function(e) { + * // UserService is an example service for managing user state + * if (UserService.isLoggedIn()) return; + * + * // Prevent $urlRouter's default handler from firing + * e.preventDefault(); + * + * UserService.handleLogin().then(function() { + * // Once the user has logged in, sync the current URL + * // to the router: + * $urlRouter.sync(); + * }); + * }); + * + * // Configures $urlRouter's listener *after* your custom listener + * $urlRouter.listen(); + * }); + *+ * + * @param {boolean} defer Indicates whether to defer location change interception. Passing + no parameter is equivalent to `true`. + */ + this.deferIntercept = function (defer) { + if (defer === undefined) defer = true; + interceptDeferred = defer; + }; + + /** + * @ngdoc object + * @name ui.router.router.$urlRouter + * + * @requires $location + * @requires $rootScope + * @requires $injector + * @requires $browser + * + * @description + * + */ + this.$get = $get; + $get.$inject = ['$location', '$rootScope', '$injector', '$browser']; + function $get( $location, $rootScope, $injector, $browser) { + + var baseHref = $browser.baseHref(), location = $location.url(), lastPushedUrl; + + function appendBasePath(url, isHtml5, absolute) { + if (baseHref === '/') return url; + if (isHtml5) return baseHref.slice(0, -1) + url; + if (absolute) return baseHref.slice(1) + url; + return url; + } + + // TODO: Optimize groups of rules with non-empty prefix into some sort of decision tree + function update(evt) { + if (evt && evt.defaultPrevented) return; + var ignoreUpdate = lastPushedUrl && $location.url() === lastPushedUrl; + lastPushedUrl = undefined; + if (ignoreUpdate) return true; + + function check(rule) { + var handled = rule($injector, $location); + + if (!handled) return false; + if (isString(handled)) $location.replace().url(handled); + return true; + } + var n = rules.length, i; + + for (i = 0; i < n; i++) { + if (check(rules[i])) return; + } + // always check otherwise last to allow dynamic updates to the set of rules + if (otherwise) check(otherwise); + } + + function listen() { + listener = listener || $rootScope.$on('$locationChangeSuccess', update); + return listener; + } + + if (!interceptDeferred) listen(); + + return { + /** + * @ngdoc function + * @name ui.router.router.$urlRouter#sync + * @methodOf ui.router.router.$urlRouter + * + * @description + * Triggers an update; the same update that happens when the address bar url changes, aka `$locationChangeSuccess`. + * This method is useful when you need to use `preventDefault()` on the `$locationChangeSuccess` event, + * perform some custom logic (route protection, auth, config, redirection, etc) and then finally proceed + * with the transition by calling `$urlRouter.sync()`. + * + * @example + *
+ * angular.module('app', ['ui.router']) + * .run(function($rootScope, $urlRouter) { + * $rootScope.$on('$locationChangeSuccess', function(evt) { + * // Halt state change from even starting + * evt.preventDefault(); + * // Perform custom logic + * var meetsRequirement = ... + * // Continue with the update and state transition if logic allows + * if (meetsRequirement) $urlRouter.sync(); + * }); + * }); + *+ */ + sync: function() { + update(); + }, + + listen: function() { + return listen(); + }, + + update: function(read) { + if (read) { + location = $location.url(); + return; + } + if ($location.url() === location) return; + + $location.url(location); + $location.replace(); + }, + + push: function(urlMatcher, params, options) { + $location.url(urlMatcher.format(params || {})); + lastPushedUrl = options && options.$$avoidResync ? $location.url() : undefined; + if (options && options.replace) $location.replace(); + }, + + /** + * @ngdoc function + * @name ui.router.router.$urlRouter#href + * @methodOf ui.router.router.$urlRouter + * + * @description + * A URL generation method that returns the compiled URL for a given + * {@link ui.router.util.type:UrlMatcher `UrlMatcher`}, populated with the provided parameters. + * + * @example + *
+ * $bob = $urlRouter.href(new UrlMatcher("/about/:person"), { + * person: "bob" + * }); + * // $bob == "/about/bob"; + *+ * + * @param {UrlMatcher} urlMatcher The `UrlMatcher` object which is used as the template of the URL to generate. + * @param {object=} params An object of parameter values to fill the matcher's required parameters. + * @param {object=} options Options object. The options are: + * + * - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. "http://www.example.com/fullurl". + * + * @returns {string} Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher` + */ + href: function(urlMatcher, params, options) { + if (!urlMatcher.validates(params)) return null; + + var isHtml5 = $locationProvider.html5Mode(); + if (angular.isObject(isHtml5)) { + isHtml5 = isHtml5.enabled; + } + + var url = urlMatcher.format(params); + options = options || {}; + + if (!isHtml5 && url !== null) { + url = "#" + $locationProvider.hashPrefix() + url; + } + url = appendBasePath(url, isHtml5, options.absolute); + + if (!options.absolute || !url) { + return url; + } + + var slash = (!isHtml5 && url ? '/' : ''), port = $location.port(); + port = (port === 80 || port === 443 ? '' : ':' + port); + + return [$location.protocol(), '://', $location.host(), port, slash, url].join(''); + } + }; + } +} + +angular.module('ui.router.router').provider('$urlRouter', $UrlRouterProvider); + +/** + * @ngdoc object + * @name ui.router.state.$stateProvider + * + * @requires ui.router.router.$urlRouterProvider + * @requires ui.router.util.$urlMatcherFactoryProvider + * + * @description + * The new `$stateProvider` works similar to Angular's v1 router, but it focuses purely + * on state. + * + * A state corresponds to a "place" in the application in terms of the overall UI and + * navigation. A state describes (via the controller / template / view properties) what + * the UI looks like and does at that place. + * + * States often have things in common, and the primary way of factoring out these + * commonalities in this model is via the state hierarchy, i.e. parent/child states aka + * nested states. + * + * The `$stateProvider` provides interfaces to declare these states for your app. + */ +$StateProvider.$inject = ['$urlRouterProvider', '$urlMatcherFactoryProvider']; +function $StateProvider( $urlRouterProvider, $urlMatcherFactory) { + + var root, states = {}, $state, queue = {}, abstractKey = 'abstract'; + + // Builds state properties from definition passed to registerState() + var stateBuilder = { + + // Derive parent state from a hierarchical name only if 'parent' is not explicitly defined. + // state.children = []; + // if (parent) parent.children.push(state); + parent: function(state) { + if (isDefined(state.parent) && state.parent) return findState(state.parent); + // regex matches any valid composite state name + // would match "contact.list" but not "contacts" + var compositeName = /^(.+)\.[^.]+$/.exec(state.name); + return compositeName ? findState(compositeName[1]) : root; + }, + + // inherit 'data' from parent and override by own values (if any) + data: function(state) { + if (state.parent && state.parent.data) { + state.data = state.self.data = extend({}, state.parent.data, state.data); + } + return state.data; + }, + + // Build a URLMatcher if necessary, either via a relative or absolute URL + url: function(state) { + var url = state.url, config = { params: state.params || {} }; + + if (isString(url)) { + if (url.charAt(0) == '^') return $urlMatcherFactory.compile(url.substring(1), config); + return (state.parent.navigable || root).url.concat(url, config); + } + + if (!url || $urlMatcherFactory.isMatcher(url)) return url; + throw new Error("Invalid url '" + url + "' in state '" + state + "'"); + }, + + // Keep track of the closest ancestor state that has a URL (i.e. is navigable) + navigable: function(state) { + return state.url ? state : (state.parent ? state.parent.navigable : null); + }, + + // Own parameters for this state. state.url.params is already built at this point. Create and add non-url params + ownParams: function(state) { + var params = state.url && state.url.params || new $$UMFP.ParamSet(); + forEach(state.params || {}, function(config, id) { + if (!params[id]) params[id] = new $$UMFP.Param(id, null, config, "config"); + }); + return params; + }, + + // Derive parameters for this state and ensure they're a super-set of parent's parameters + params: function(state) { + return state.parent && state.parent.params ? extend(state.parent.params.$$new(), state.ownParams) : new $$UMFP.ParamSet(); + }, + + // If there is no explicit multi-view configuration, make one up so we don't have + // to handle both cases in the view directive later. Note that having an explicit + // 'views' property will mean the default unnamed view properties are ignored. This + // is also a good time to resolve view names to absolute names, so everything is a + // straight lookup at link time. + views: function(state) { + var views = {}; + + forEach(isDefined(state.views) ? state.views : { '': state }, function (view, name) { + if (name.indexOf('@') < 0) name += '@' + state.parent.name; + views[name] = view; + }); + return views; + }, + + // Keep a full path from the root down to this state as this is needed for state activation. + path: function(state) { + return state.parent ? state.parent.path.concat(state) : []; // exclude root from path + }, + + // Speed up $state.contains() as it's used a lot + includes: function(state) { + var includes = state.parent ? extend({}, state.parent.includes) : {}; + includes[state.name] = true; + return includes; + }, + + $delegates: {} + }; + + function isRelative(stateName) { + return stateName.indexOf(".") === 0 || stateName.indexOf("^") === 0; + } + + function findState(stateOrName, base) { + if (!stateOrName) return undefined; + + var isStr = isString(stateOrName), + name = isStr ? stateOrName : stateOrName.name, + path = isRelative(name); + + if (path) { + if (!base) throw new Error("No reference point given for path '" + name + "'"); + base = findState(base); + + var rel = name.split("."), i = 0, pathLength = rel.length, current = base; + + for (; i < pathLength; i++) { + if (rel[i] === "" && i === 0) { + current = base; + continue; + } + if (rel[i] === "^") { + if (!current.parent) throw new Error("Path '" + name + "' not valid for state '" + base.name + "'"); + current = current.parent; + continue; + } + break; + } + rel = rel.slice(i).join("."); + name = current.name + (current.name && rel ? "." : "") + rel; + } + var state = states[name]; + + if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) { + return state; + } + return undefined; + } + + function queueState(parentName, state) { + if (!queue[parentName]) { + queue[parentName] = []; + } + queue[parentName].push(state); + } + + function flushQueuedChildren(parentName) { + var queued = queue[parentName] || []; + while(queued.length) { + registerState(queued.shift()); + } + } + + function registerState(state) { + // Wrap a new object around the state so we can store our private details easily. + state = inherit(state, { + self: state, + resolve: state.resolve || {}, + toString: function() { return this.name; } + }); + + var name = state.name; + if (!isString(name) || name.indexOf('@') >= 0) throw new Error("State must have a valid name"); + if (states.hasOwnProperty(name)) throw new Error("State '" + name + "'' is already defined"); + + // Get parent name + var parentName = (name.indexOf('.') !== -1) ? name.substring(0, name.lastIndexOf('.')) + : (isString(state.parent)) ? state.parent + : (isObject(state.parent) && isString(state.parent.name)) ? state.parent.name + : ''; + + // If parent is not registered yet, add state to queue and register later + if (parentName && !states[parentName]) { + return queueState(parentName, state.self); + } + + for (var key in stateBuilder) { + if (isFunction(stateBuilder[key])) state[key] = stateBuilder[key](state, stateBuilder.$delegates[key]); + } + states[name] = state; + + // Register the state in the global state list and with $urlRouter if necessary. + if (!state[abstractKey] && state.url) { + $urlRouterProvider.when(state.url, ['$match', '$stateParams', function ($match, $stateParams) { + if ($state.$current.navigable != state || !equalForKeys($match, $stateParams)) { + $state.transitionTo(state, $match, { inherit: true, location: false }); + } + }]); + } + + // Register any queued children + flushQueuedChildren(name); + + return state; + } + + // Checks text to see if it looks like a glob. + function isGlob (text) { + return text.indexOf('*') > -1; + } + + // Returns true if glob matches current $state name. + function doesStateMatchGlob (glob) { + var globSegments = glob.split('.'), + segments = $state.$current.name.split('.'); + + //match greedy starts + if (globSegments[0] === '**') { + segments = segments.slice(indexOf(segments, globSegments[1])); + segments.unshift('**'); + } + //match greedy ends + if (globSegments[globSegments.length - 1] === '**') { + segments.splice(indexOf(segments, globSegments[globSegments.length - 2]) + 1, Number.MAX_VALUE); + segments.push('**'); + } + + if (globSegments.length != segments.length) { + return false; + } + + //match single stars + for (var i = 0, l = globSegments.length; i < l; i++) { + if (globSegments[i] === '*') { + segments[i] = '*'; + } + } + + return segments.join('') === globSegments.join(''); + } + + + // Implicit root state that is always active + root = registerState({ + name: '', + url: '^', + views: null, + 'abstract': true + }); + root.navigable = null; + + + /** + * @ngdoc function + * @name ui.router.state.$stateProvider#decorator + * @methodOf ui.router.state.$stateProvider + * + * @description + * Allows you to extend (carefully) or override (at your own peril) the + * `stateBuilder` object used internally by `$stateProvider`. This can be used + * to add custom functionality to ui-router, for example inferring templateUrl + * based on the state name. + * + * When passing only a name, it returns the current (original or decorated) builder + * function that matches `name`. + * + * The builder functions that can be decorated are listed below. Though not all + * necessarily have a good use case for decoration, that is up to you to decide. + * + * In addition, users can attach custom decorators, which will generate new + * properties within the state's internal definition. There is currently no clear + * use-case for this beyond accessing internal states (i.e. $state.$current), + * however, expect this to become increasingly relevant as we introduce additional + * meta-programming features. + * + * **Warning**: Decorators should not be interdependent because the order of + * execution of the builder functions in non-deterministic. Builder functions + * should only be dependent on the state definition object and super function. + * + * + * Existing builder functions and current return values: + * + * - **parent** `{object}` - returns the parent state object. + * - **data** `{object}` - returns state data, including any inherited data that is not + * overridden by own values (if any). + * - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher} + * or `null`. + * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is + * navigable). + * - **params** `{object}` - returns an array of state params that are ensured to + * be a super-set of parent's params. + * - **views** `{object}` - returns a views object where each key is an absolute view + * name (i.e. "viewName@stateName") and each value is the config object + * (template, controller) for the view. Even when you don't use the views object + * explicitly on a state config, one is still created for you internally. + * So by decorating this builder function you have access to decorating template + * and controller properties. + * - **ownParams** `{object}` - returns an array of params that belong to the state, + * not including any params defined by ancestor states. + * - **path** `{string}` - returns the full path from the root down to this state. + * Needed for state activation. + * - **includes** `{object}` - returns an object that includes every state that + * would pass a `$state.includes()` test. + * + * @example + *
+ * // Override the internal 'views' builder with a function that takes the state + * // definition, and a reference to the internal function being overridden: + * $stateProvider.decorator('views', function (state, parent) { + * var result = {}, + * views = parent(state); + * + * angular.forEach(views, function (config, name) { + * var autoName = (state.name + '.' + name).replace('.', '/'); + * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html'; + * result[name] = config; + * }); + * return result; + * }); + * + * $stateProvider.state('home', { + * views: { + * 'contact.list': { controller: 'ListController' }, + * 'contact.item': { controller: 'ItemController' } + * } + * }); + * + * // ... + * + * $state.go('home'); + * // Auto-populates list and item views with /partials/home/contact/list.html, + * // and /partials/home/contact/item.html, respectively. + *+ * + * @param {string} name The name of the builder function to decorate. + * @param {object} func A function that is responsible for decorating the original + * builder function. The function receives two parameters: + * + * - `{object}` - state - The state config object. + * - `{object}` - super - The original builder function. + * + * @return {object} $stateProvider - $stateProvider instance + */ + this.decorator = decorator; + function decorator(name, func) { + /*jshint validthis: true */ + if (isString(name) && !isDefined(func)) { + return stateBuilder[name]; + } + if (!isFunction(func) || !isString(name)) { + return this; + } + if (stateBuilder[name] && !stateBuilder.$delegates[name]) { + stateBuilder.$delegates[name] = stateBuilder[name]; + } + stateBuilder[name] = func; + return this; + } + + /** + * @ngdoc function + * @name ui.router.state.$stateProvider#state + * @methodOf ui.router.state.$stateProvider + * + * @description + * Registers a state configuration under a given state name. The stateConfig object + * has the following acceptable properties. + * + * @param {string} name A unique state name, e.g. "home", "about", "contacts". + * To create a parent/child state use a dot, e.g. "about.sales", "home.newest". + * @param {object} stateConfig State configuration object. + * @param {string|function=} stateConfig.template + * + * html template as a string or a function that returns + * an html template as a string which should be used by the uiView directives. This property + * takes precedence over templateUrl. + * + * If `template` is a function, it will be called with the following parameters: + * + * - {array.<object>} - state parameters extracted from the current $location.path() by + * applying the current state + * + *
template: + * "+ *inline template definition
" + + * ""
template: function(params) { + * return "+ * + * + * @param {string|function=} stateConfig.templateUrl + * + * + * path or function that returns a path to an html + * template that should be used by uiView. + * + * If `templateUrl` is a function, it will be called with the following parameters: + * + * - {array.<object>} - state parameters extracted from the current $location.path() by + * applying the current state + * + *generated template
"; }
templateUrl: "home.html"+ *
templateUrl: function(params) { + * return myTemplates[params.pageId]; }+ * + * @param {function=} stateConfig.templateProvider + * + * Provider function that returns HTML content string. + *
templateProvider: + * function(MyTemplateService, params) { + * return MyTemplateService.getTemplate(params.pageId); + * }+ * + * @param {string|function=} stateConfig.controller + * + * + * Controller fn that should be associated with newly + * related scope or the name of a registered controller if passed as a string. + * Optionally, the ControllerAs may be declared here. + *
controller: "MyRegisteredController"+ *
controller: + * "MyRegisteredController as fooCtrl"}+ *
controller: function($scope, MyService) { + * $scope.data = MyService.getData(); }+ * + * @param {function=} stateConfig.controllerProvider + * + * + * Injectable provider function that returns the actual controller or string. + *
controllerProvider: + * function(MyResolveData) { + * if (MyResolveData.foo) + * return "FooCtrl" + * else if (MyResolveData.bar) + * return "BarCtrl"; + * else return function($scope) { + * $scope.baz = "Qux"; + * } + * }+ * + * @param {string=} stateConfig.controllerAs + * + * + * A controller alias name. If present the controller will be + * published to scope under the controllerAs name. + *
controllerAs: "myCtrl"+ * + * @param {object=} stateConfig.resolve + * + * + * An optional map<string, function> of dependencies which + * should be injected into the controller. If any of these dependencies are promises, + * the router will wait for them all to be resolved before the controller is instantiated. + * If all the promises are resolved successfully, the $stateChangeSuccess event is fired + * and the values of the resolved promises are injected into any controllers that reference them. + * If any of the promises are rejected the $stateChangeError event is fired. + * + * The map object is: + * + * - key - {string}: name of dependency to be injected into controller + * - factory - {string|function}: If string then it is alias for service. Otherwise if function, + * it is injected and return value it treated as dependency. If result is a promise, it is + * resolved before its value is injected into controller. + * + *
resolve: { + * myResolve1: + * function($http, $stateParams) { + * return $http.get("/api/foos/"+stateParams.fooID); + * } + * }+ * + * @param {string=} stateConfig.url + * + * + * A url fragment with optional parameters. When a state is navigated or + * transitioned to, the `$stateParams` service will be populated with any + * parameters that were passed. + * + * examples: + *
url: "/home" + * url: "/users/:userid" + * url: "/books/{bookid:[a-zA-Z_-]}" + * url: "/books/{categoryid:int}" + * url: "/books/{publishername:string}/{categoryid:int}" + * url: "/messages?before&after" + * url: "/messages?{before:date}&{after:date}"+ * url: "/messages/:mailboxid?{before:date}&{after:date}" + * + * @param {object=} stateConfig.views + * + * an optional map<string, object> which defined multiple views, or targets views + * manually/explicitly. + * + * Examples: + * + * Targets three named `ui-view`s in the parent state's template + *
views: { + * header: { + * controller: "headerCtrl", + * templateUrl: "header.html" + * }, body: { + * controller: "bodyCtrl", + * templateUrl: "body.html" + * }, footer: { + * controller: "footCtrl", + * templateUrl: "footer.html" + * } + * }+ * + * Targets named `ui-view="header"` from grandparent state 'top''s template, and named `ui-view="body" from parent state's template. + *
views: { + * 'header@top': { + * controller: "msgHeaderCtrl", + * templateUrl: "msgHeader.html" + * }, 'body': { + * controller: "messagesCtrl", + * templateUrl: "messages.html" + * } + * }+ * + * @param {boolean=} [stateConfig.abstract=false] + * + * An abstract state will never be directly activated, + * but can provide inherited properties to its common children states. + *
abstract: true+ * + * @param {function=} stateConfig.onEnter + * + * + * Callback function for when a state is entered. Good way + * to trigger an action or dispatch an event, such as opening a dialog. + * If minifying your scripts, make sure to explictly annotate this function, + * because it won't be automatically annotated by your build tools. + * + *
onEnter: function(MyService, $stateParams) { + * MyService.foo($stateParams.myParam); + * }+ * + * @param {function=} stateConfig.onExit + * + * + * Callback function for when a state is exited. Good way to + * trigger an action or dispatch an event, such as opening a dialog. + * If minifying your scripts, make sure to explictly annotate this function, + * because it won't be automatically annotated by your build tools. + * + *
onExit: function(MyService, $stateParams) { + * MyService.cleanup($stateParams.myParam); + * }+ * + * @param {boolean=} [stateConfig.reloadOnSearch=true] + * + * + * If `false`, will not retrigger the same state + * just because a search/query parameter has changed (via $location.search() or $location.hash()). + * Useful for when you'd like to modify $location.search() without triggering a reload. + *
reloadOnSearch: false+ * + * @param {object=} stateConfig.data + * + * + * Arbitrary data object, useful for custom configuration. The parent state's `data` is + * prototypally inherited. In other words, adding a data property to a state adds it to + * the entire subtree via prototypal inheritance. + * + *
data: { + * requiredRole: 'foo' + * }+ * + * @param {object=} stateConfig.params + * + * + * A map which optionally configures parameters declared in the `url`, or + * defines additional non-url parameters. For each parameter being + * configured, add a configuration object keyed to the name of the parameter. + * + * Each parameter configuration object may contain the following properties: + * + * - ** value ** - {object|function=}: specifies the default value for this + * parameter. This implicitly sets this parameter as optional. + * + * When UI-Router routes to a state and no value is + * specified for this parameter in the URL or transition, the + * default value will be used instead. If `value` is a function, + * it will be injected and invoked, and the return value used. + * + * *Note*: `undefined` is treated as "no default value" while `null` + * is treated as "the default value is `null`". + * + * *Shorthand*: If you only need to configure the default value of the + * parameter, you may use a shorthand syntax. In the **`params`** + * map, instead mapping the param name to a full parameter configuration + * object, simply set map it to the default parameter value, e.g.: + * + *
// define a parameter's default value + * params: { + * param1: { value: "defaultValue" } + * } + * // shorthand default values + * params: { + * param1: "defaultValue", + * param2: "param2Default" + * }+ * + * - ** array ** - {boolean=}: *(default: false)* If true, the param value will be + * treated as an array of values. If you specified a Type, the value will be + * treated as an array of the specified Type. Note: query parameter values + * default to a special `"auto"` mode. + * + * For query parameters in `"auto"` mode, if multiple values for a single parameter + * are present in the URL (e.g.: `/foo?bar=1&bar=2&bar=3`) then the values + * are mapped to an array (e.g.: `{ foo: [ '1', '2', '3' ] }`). However, if + * only one value is present (e.g.: `/foo?bar=1`) then the value is treated as single + * value (e.g.: `{ foo: '1' }`). + * + *
params: { + * param1: { array: true } + * }+ * + * - ** squash ** - {bool|string=}: `squash` configures how a default parameter value is represented in the URL when + * the current parameter value is the same as the default value. If `squash` is not set, it uses the + * configured default squash policy. + * (See {@link ui.router.util.$urlMatcherFactory#methods_defaultSquashPolicy `defaultSquashPolicy()`}) + * + * There are three squash settings: + * + * - false: The parameter's default value is not squashed. It is encoded and included in the URL + * - true: The parameter's default value is omitted from the URL. If the parameter is preceeded and followed + * by slashes in the state's `url` declaration, then one of those slashes are omitted. + * This can allow for cleaner looking URLs. + * - `"
params: { + * param1: { + * value: "defaultId", + * squash: true + * } } + * // squash "defaultValue" to "~" + * params: { + * param1: { + * value: "defaultValue", + * squash: "~" + * } } + *+ * + * + * @example + *
+ * // Some state name examples + * + * // stateName can be a single top-level name (must be unique). + * $stateProvider.state("home", {}); + * + * // Or it can be a nested state name. This state is a child of the + * // above "home" state. + * $stateProvider.state("home.newest", {}); + * + * // Nest states as deeply as needed. + * $stateProvider.state("home.newest.abc.xyz.inception", {}); + * + * // state() returns $stateProvider, so you can chain state declarations. + * $stateProvider + * .state("home", {}) + * .state("about", {}) + * .state("contacts", {}); + *+ * + */ + this.state = state; + function state(name, definition) { + /*jshint validthis: true */ + if (isObject(name)) definition = name; + else definition.name = name; + registerState(definition); + return this; + } + + /** + * @ngdoc object + * @name ui.router.state.$state + * + * @requires $rootScope + * @requires $q + * @requires ui.router.state.$view + * @requires $injector + * @requires ui.router.util.$resolve + * @requires ui.router.state.$stateParams + * @requires ui.router.router.$urlRouter + * + * @property {object} params A param object, e.g. {sectionId: section.id)}, that + * you'd like to test against the current active state. + * @property {object} current A reference to the state's config object. However + * you passed it in. Useful for accessing custom data. + * @property {object} transition Currently pending transition. A promise that'll + * resolve or reject. + * + * @description + * `$state` service is responsible for representing states as well as transitioning + * between them. It also provides interfaces to ask for current state or even states + * you're coming from. + */ + this.$get = $get; + $get.$inject = ['$rootScope', '$q', '$view', '$injector', '$resolve', '$stateParams', '$urlRouter', '$location', '$urlMatcherFactory']; + function $get( $rootScope, $q, $view, $injector, $resolve, $stateParams, $urlRouter, $location, $urlMatcherFactory) { + + var TransitionSuperseded = $q.reject(new Error('transition superseded')); + var TransitionPrevented = $q.reject(new Error('transition prevented')); + var TransitionAborted = $q.reject(new Error('transition aborted')); + var TransitionFailed = $q.reject(new Error('transition failed')); + + // Handles the case where a state which is the target of a transition is not found, and the user + // can optionally retry or defer the transition + function handleRedirect(redirect, state, params, options) { + /** + * @ngdoc event + * @name ui.router.state.$state#$stateNotFound + * @eventOf ui.router.state.$state + * @eventType broadcast on root scope + * @description + * Fired when a requested state **cannot be found** using the provided state name during transition. + * The event is broadcast allowing any handlers a single chance to deal with the error (usually by + * lazy-loading the unfound state). A special `unfoundState` object is passed to the listener handler, + * you can see its three properties in the example. You can use `event.preventDefault()` to abort the + * transition and the promise returned from `go` will be rejected with a `'transition aborted'` value. + * + * @param {Object} event Event object. + * @param {Object} unfoundState Unfound State information. Contains: `to, toParams, options` properties. + * @param {State} fromState Current state object. + * @param {Object} fromParams Current state params. + * + * @example + * + *
+ * // somewhere, assume lazy.state has not been defined + * $state.go("lazy.state", {a:1, b:2}, {inherit:false}); + * + * // somewhere else + * $scope.$on('$stateNotFound', + * function(event, unfoundState, fromState, fromParams){ + * console.log(unfoundState.to); // "lazy.state" + * console.log(unfoundState.toParams); // {a:1, b:2} + * console.log(unfoundState.options); // {inherit:false} + default options + * }) + *+ */ + var evt = $rootScope.$broadcast('$stateNotFound', redirect, state, params); + + if (evt.defaultPrevented) { + $urlRouter.update(); + return TransitionAborted; + } + + if (!evt.retry) { + return null; + } + + // Allow the handler to return a promise to defer state lookup retry + if (options.$retry) { + $urlRouter.update(); + return TransitionFailed; + } + var retryTransition = $state.transition = $q.when(evt.retry); + + retryTransition.then(function() { + if (retryTransition !== $state.transition) return TransitionSuperseded; + redirect.options.$retry = true; + return $state.transitionTo(redirect.to, redirect.toParams, redirect.options); + }, function() { + return TransitionAborted; + }); + $urlRouter.update(); + + return retryTransition; + } + + root.locals = { resolve: null, globals: { $stateParams: {} } }; + + $state = { + params: {}, + current: root.self, + $current: root, + transition: null + }; + + /** + * @ngdoc function + * @name ui.router.state.$state#reload + * @methodOf ui.router.state.$state + * + * @description + * A method that force reloads the current state. All resolves are re-resolved, events are not re-fired, + * and controllers reinstantiated (bug with controllers reinstantiating right now, fixing soon). + * + * @example + *
+ * var app angular.module('app', ['ui.router']); + * + * app.controller('ctrl', function ($scope, $state) { + * $scope.reload = function(){ + * $state.reload(); + * } + * }); + *+ * + * `reload()` is just an alias for: + *
+ * $state.transitionTo($state.current, $stateParams, { + * reload: true, inherit: false, notify: true + * }); + *+ * + * @returns {promise} A promise representing the state of the new transition. See + * {@link ui.router.state.$state#methods_go $state.go}. + */ + $state.reload = function reload() { + return $state.transitionTo($state.current, $stateParams, { reload: true, inherit: false, notify: true }); + }; + + /** + * @ngdoc function + * @name ui.router.state.$state#go + * @methodOf ui.router.state.$state + * + * @description + * Convenience method for transitioning to a new state. `$state.go` calls + * `$state.transitionTo` internally but automatically sets options to + * `{ location: true, inherit: true, relative: $state.$current, notify: true }`. + * This allows you to easily use an absolute or relative to path and specify + * only the parameters you'd like to update (while letting unspecified parameters + * inherit from the currently active ancestor states). + * + * @example + *
+ * var app = angular.module('app', ['ui.router']); + * + * app.controller('ctrl', function ($scope, $state) { + * $scope.changeState = function () { + * $state.go('contact.detail'); + * }; + * }); + *+ *
+ * var app = angular.module('app', ['ui.router']); + * + * app.controller('ctrl', function ($scope, $state) { + * $scope.changeState = function () { + * $state.transitionTo('contact.detail'); + * }; + * }); + *+ * + * @param {string} to State name. + * @param {object=} toParams A map of the parameters that will be sent to the state, + * will populate $stateParams. + * @param {object=} options Options object. The options are: + * + * - **`location`** - {boolean=true|string=} - If `true` will update the url in the location bar, if `false` + * will not. If string, must be `"replace"`, which will update url and also replace last history record. + * - **`inherit`** - {boolean=false}, If `true` will inherit url parameters from current url. + * - **`relative`** - {object=}, When transitioning with relative path (e.g '^'), + * defines which state to be relative from. + * - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events. + * - **`reload`** (v0.2.5) - {boolean=false}, If `true` will force transition even if the state or params + * have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd + * use this when you want to force a reload when *everything* is the same, including search params. + * + * @returns {promise} A promise representing the state of the new transition. See + * {@link ui.router.state.$state#methods_go $state.go}. + */ + $state.transitionTo = function transitionTo(to, toParams, options) { + toParams = toParams || {}; + options = extend({ + location: true, inherit: false, relative: null, notify: true, reload: false, $retry: false + }, options || {}); + + var from = $state.$current, fromParams = $state.params, fromPath = from.path; + var evt, toState = findState(to, options.relative); + + if (!isDefined(toState)) { + var redirect = { to: to, toParams: toParams, options: options }; + var redirectResult = handleRedirect(redirect, from.self, fromParams, options); + + if (redirectResult) { + return redirectResult; + } + + // Always retry once if the $stateNotFound was not prevented + // (handles either redirect changed or state lazy-definition) + to = redirect.to; + toParams = redirect.toParams; + options = redirect.options; + toState = findState(to, options.relative); + + if (!isDefined(toState)) { + if (!options.relative) throw new Error("No such state '" + to + "'"); + throw new Error("Could not resolve '" + to + "' from state '" + options.relative + "'"); + } + } + if (toState[abstractKey]) throw new Error("Cannot transition to abstract state '" + to + "'"); + if (options.inherit) toParams = inheritParams($stateParams, toParams || {}, $state.$current, toState); + if (!toState.params.$$validates(toParams)) return TransitionFailed; + + toParams = toState.params.$$values(toParams); + to = toState; + + var toPath = to.path; + + // Starting from the root of the path, keep all levels that haven't changed + var keep = 0, state = toPath[keep], locals = root.locals, toLocals = []; + + if (!options.reload) { + while (state && state === fromPath[keep] && state.ownParams.$$equals(toParams, fromParams)) { + locals = toLocals[keep] = state.locals; + keep++; + state = toPath[keep]; + } + } + + // If we're going to the same state and all locals are kept, we've got nothing to do. + // But clear 'transition', as we still want to cancel any other pending transitions. + // TODO: We may not want to bump 'transition' if we're called from a location change + // that we've initiated ourselves, because we might accidentally abort a legitimate + // transition initiated from code? + if (shouldTriggerReload(to, from, locals, options)) { + if (to.self.reloadOnSearch !== false) $urlRouter.update(); + $state.transition = null; + return $q.when($state.current); + } + + // Filter parameters before we pass them to event handlers etc. + toParams = filterByKeys(to.params.$$keys(), toParams || {}); + + // Broadcast start event and cancel the transition if requested + if (options.notify) { + /** + * @ngdoc event + * @name ui.router.state.$state#$stateChangeStart + * @eventOf ui.router.state.$state + * @eventType broadcast on root scope + * @description + * Fired when the state transition **begins**. You can use `event.preventDefault()` + * to prevent the transition from happening and then the transition promise will be + * rejected with a `'transition prevented'` value. + * + * @param {Object} event Event object. + * @param {State} toState The state being transitioned to. + * @param {Object} toParams The params supplied to the `toState`. + * @param {State} fromState The current state, pre-transition. + * @param {Object} fromParams The params supplied to the `fromState`. + * + * @example + * + *
+ * $rootScope.$on('$stateChangeStart', + * function(event, toState, toParams, fromState, fromParams){ + * event.preventDefault(); + * // transitionTo() promise will be rejected with + * // a 'transition prevented' error + * }) + *+ */ + if ($rootScope.$broadcast('$stateChangeStart', to.self, toParams, from.self, fromParams).defaultPrevented) { + $urlRouter.update(); + return TransitionPrevented; + } + } + + // Resolve locals for the remaining states, but don't update any global state just + // yet -- if anything fails to resolve the current state needs to remain untouched. + // We also set up an inheritance chain for the locals here. This allows the view directive + // to quickly look up the correct definition for each view in the current state. Even + // though we create the locals object itself outside resolveState(), it is initially + // empty and gets filled asynchronously. We need to keep track of the promise for the + // (fully resolved) current locals, and pass this down the chain. + var resolved = $q.when(locals); + + for (var l = keep; l < toPath.length; l++, state = toPath[l]) { + locals = toLocals[l] = inherit(locals); + resolved = resolveState(state, toParams, state === to, resolved, locals, options); + } + + // Once everything is resolved, we are ready to perform the actual transition + // and return a promise for the new state. We also keep track of what the + // current promise is, so that we can detect overlapping transitions and + // keep only the outcome of the last transition. + var transition = $state.transition = resolved.then(function () { + var l, entering, exiting; + + if ($state.transition !== transition) return TransitionSuperseded; + + // Exit 'from' states not kept + for (l = fromPath.length - 1; l >= keep; l--) { + exiting = fromPath[l]; + if (exiting.self.onExit) { + $injector.invoke(exiting.self.onExit, exiting.self, exiting.locals.globals); + } + exiting.locals = null; + } + + // Enter 'to' states not kept + for (l = keep; l < toPath.length; l++) { + entering = toPath[l]; + entering.locals = toLocals[l]; + if (entering.self.onEnter) { + $injector.invoke(entering.self.onEnter, entering.self, entering.locals.globals); + } + } + + // Run it again, to catch any transitions in callbacks + if ($state.transition !== transition) return TransitionSuperseded; + + // Update globals in $state + $state.$current = to; + $state.current = to.self; + $state.params = toParams; + copy($state.params, $stateParams); + $state.transition = null; + + if (options.location && to.navigable) { + $urlRouter.push(to.navigable.url, to.navigable.locals.globals.$stateParams, { + $$avoidResync: true, replace: options.location === 'replace' + }); + } + + if (options.notify) { + /** + * @ngdoc event + * @name ui.router.state.$state#$stateChangeSuccess + * @eventOf ui.router.state.$state + * @eventType broadcast on root scope + * @description + * Fired once the state transition is **complete**. + * + * @param {Object} event Event object. + * @param {State} toState The state being transitioned to. + * @param {Object} toParams The params supplied to the `toState`. + * @param {State} fromState The current state, pre-transition. + * @param {Object} fromParams The params supplied to the `fromState`. + */ + $rootScope.$broadcast('$stateChangeSuccess', to.self, toParams, from.self, fromParams); + } + $urlRouter.update(true); + + return $state.current; + }, function (error) { + if ($state.transition !== transition) return TransitionSuperseded; + + $state.transition = null; + /** + * @ngdoc event + * @name ui.router.state.$state#$stateChangeError + * @eventOf ui.router.state.$state + * @eventType broadcast on root scope + * @description + * Fired when an **error occurs** during transition. It's important to note that if you + * have any errors in your resolve functions (javascript errors, non-existent services, etc) + * they will not throw traditionally. You must listen for this $stateChangeError event to + * catch **ALL** errors. + * + * @param {Object} event Event object. + * @param {State} toState The state being transitioned to. + * @param {Object} toParams The params supplied to the `toState`. + * @param {State} fromState The current state, pre-transition. + * @param {Object} fromParams The params supplied to the `fromState`. + * @param {Error} error The resolve error object. + */ + evt = $rootScope.$broadcast('$stateChangeError', to.self, toParams, from.self, fromParams, error); + + if (!evt.defaultPrevented) { + $urlRouter.update(); + } + + return $q.reject(error); + }); + + return transition; + }; + + /** + * @ngdoc function + * @name ui.router.state.$state#is + * @methodOf ui.router.state.$state + * + * @description + * Similar to {@link ui.router.state.$state#methods_includes $state.includes}, + * but only checks for the full state name. If params is supplied then it will be + * tested for strict equality against the current active params object, so all params + * must match with none missing and no extras. + * + * @example + *
+ * $state.$current.name = 'contacts.details.item'; + * + * // absolute name + * $state.is('contact.details.item'); // returns true + * $state.is(contactDetailItemStateObject); // returns true + * + * // relative name (. and ^), typically from a template + * // E.g. from the 'contacts.details' template + *+ * + * @param {string|object} stateOrName The state name (absolute or relative) or state object you'd like to check. + * @param {object=} params A param object, e.g. `{sectionId: section.id}`, that you'd like + * to test against the current active state. + * @param {object=} options An options object. The options are: + * + * - **`relative`** - {string|object} - If `stateOrName` is a relative state name and `options.relative` is set, .is will + * test relative to `options.relative` state (or name). + * + * @returns {boolean} Returns true if it is the state. + */ + $state.is = function is(stateOrName, params, options) { + options = extend({ relative: $state.$current }, options || {}); + var state = findState(stateOrName, options.relative); + + if (!isDefined(state)) { return undefined; } + if ($state.$current !== state) { return false; } + return params ? equalForKeys(state.params.$$values(params), $stateParams) : true; + }; + + /** + * @ngdoc function + * @name ui.router.state.$state#includes + * @methodOf ui.router.state.$state + * + * @description + * A method to determine if the current active state is equal to or is the child of the + * state stateName. If any params are passed then they will be tested for a match as well. + * Not all the parameters need to be passed, just the ones you'd like to test for equality. + * + * @example + * Partial and relative names + *Item+ *
+ * $state.$current.name = 'contacts.details.item'; + * + * // Using partial names + * $state.includes("contacts"); // returns true + * $state.includes("contacts.details"); // returns true + * $state.includes("contacts.details.item"); // returns true + * $state.includes("contacts.list"); // returns false + * $state.includes("about"); // returns false + * + * // Using relative names (. and ^), typically from a template + * // E.g. from the 'contacts.details' template + *+ * + * Basic globbing patterns + *Item+ *
+ * $state.$current.name = 'contacts.details.item.url'; + * + * $state.includes("*.details.*.*"); // returns true + * $state.includes("*.details.**"); // returns true + * $state.includes("**.item.**"); // returns true + * $state.includes("*.details.item.url"); // returns true + * $state.includes("*.details.*.url"); // returns true + * $state.includes("*.details.*"); // returns false + * $state.includes("item.**"); // returns false + *+ * + * @param {string} stateOrName A partial name, relative name, or glob pattern + * to be searched for within the current state name. + * @param {object=} params A param object, e.g. `{sectionId: section.id}`, + * that you'd like to test against the current active state. + * @param {object=} options An options object. The options are: + * + * - **`relative`** - {string|object=} - If `stateOrName` is a relative state reference and `options.relative` is set, + * .includes will test relative to `options.relative` state (or name). + * + * @returns {boolean} Returns true if it does include the state + */ + $state.includes = function includes(stateOrName, params, options) { + options = extend({ relative: $state.$current }, options || {}); + if (isString(stateOrName) && isGlob(stateOrName)) { + if (!doesStateMatchGlob(stateOrName)) { + return false; + } + stateOrName = $state.$current.name; + } + + var state = findState(stateOrName, options.relative); + if (!isDefined(state)) { return undefined; } + if (!isDefined($state.$current.includes[state.name])) { return false; } + return params ? equalForKeys(state.params.$$values(params), $stateParams, objectKeys(params)) : true; + }; + + + /** + * @ngdoc function + * @name ui.router.state.$state#href + * @methodOf ui.router.state.$state + * + * @description + * A url generation method that returns the compiled url for the given state populated with the given params. + * + * @example + *
+ * expect($state.href("about.person", { person: "bob" })).toEqual("/about/bob"); + *+ * + * @param {string|object} stateOrName The state name or state object you'd like to generate a url from. + * @param {object=} params An object of parameter values to fill the state's required parameters. + * @param {object=} options Options object. The options are: + * + * - **`lossy`** - {boolean=true} - If true, and if there is no url associated with the state provided in the + * first parameter, then the constructed href url will be built from the first navigable ancestor (aka + * ancestor with a valid url). + * - **`inherit`** - {boolean=true}, If `true` will inherit url parameters from current url. + * - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'), + * defines which state to be relative from. + * - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. "http://www.example.com/fullurl". + * + * @returns {string} compiled state url + */ + $state.href = function href(stateOrName, params, options) { + options = extend({ + lossy: true, + inherit: true, + absolute: false, + relative: $state.$current + }, options || {}); + + var state = findState(stateOrName, options.relative); + + if (!isDefined(state)) return null; + if (options.inherit) params = inheritParams($stateParams, params || {}, $state.$current, state); + + var nav = (state && options.lossy) ? state.navigable : state; + + if (!nav || nav.url === undefined || nav.url === null) { + return null; + } + return $urlRouter.href(nav.url, filterByKeys(state.params.$$keys(), params || {}), { + absolute: options.absolute + }); + }; + + /** + * @ngdoc function + * @name ui.router.state.$state#get + * @methodOf ui.router.state.$state + * + * @description + * Returns the state configuration object for any specific state or all states. + * + * @param {string|object=} stateOrName (absolute or relative) If provided, will only get the config for + * the requested state. If not provided, returns an array of ALL state configs. + * @param {string|object=} context When stateOrName is a relative state reference, the state will be retrieved relative to context. + * @returns {Object|Array} State configuration object or array of all objects. + */ + $state.get = function (stateOrName, context) { + if (arguments.length === 0) return map(objectKeys(states), function(name) { return states[name].self; }); + var state = findState(stateOrName, context || $state.$current); + return (state && state.self) ? state.self : null; + }; + + function resolveState(state, params, paramsAreFiltered, inherited, dst, options) { + // Make a restricted $stateParams with only the parameters that apply to this state if + // necessary. In addition to being available to the controller and onEnter/onExit callbacks, + // we also need $stateParams to be available for any $injector calls we make during the + // dependency resolution process. + var $stateParams = (paramsAreFiltered) ? params : filterByKeys(state.params.$$keys(), params); + var locals = { $stateParams: $stateParams }; + + // Resolve 'global' dependencies for the state, i.e. those not specific to a view. + // We're also including $stateParams in this; that way the parameters are restricted + // to the set that should be visible to the state, and are independent of when we update + // the global $state and $stateParams values. + dst.resolve = $resolve.resolve(state.resolve, locals, dst.resolve, state); + var promises = [dst.resolve.then(function (globals) { + dst.globals = globals; + })]; + if (inherited) promises.push(inherited); + + // Resolve template and dependencies for all views. + forEach(state.views, function (view, name) { + var injectables = (view.resolve && view.resolve !== state.resolve ? view.resolve : {}); + injectables.$template = [ function () { + return $view.load(name, { view: view, locals: locals, params: $stateParams, notify: options.notify }) || ''; + }]; + + promises.push($resolve.resolve(injectables, locals, dst.resolve, state).then(function (result) { + // References to the controller (only instantiated at link time) + if (isFunction(view.controllerProvider) || isArray(view.controllerProvider)) { + var injectLocals = angular.extend({}, injectables, locals); + result.$$controller = $injector.invoke(view.controllerProvider, null, injectLocals); + } else { + result.$$controller = view.controller; + } + // Provide access to the state itself for internal use + result.$$state = state; + result.$$controllerAs = view.controllerAs; + dst[name] = result; + })); + }); + + // Wait for all the promises and then return the activation object + return $q.all(promises).then(function (values) { + return dst; + }); + } + + return $state; + } + + function shouldTriggerReload(to, from, locals, options) { + if (to === from && ((locals === from.locals && !options.reload) || (to.self.reloadOnSearch === false))) { + return true; + } + } +} + +angular.module('ui.router.state') + .value('$stateParams', {}) + .provider('$state', $StateProvider); + + +$ViewProvider.$inject = []; +function $ViewProvider() { + + this.$get = $get; + /** + * @ngdoc object + * @name ui.router.state.$view + * + * @requires ui.router.util.$templateFactory + * @requires $rootScope + * + * @description + * + */ + $get.$inject = ['$rootScope', '$templateFactory']; + function $get( $rootScope, $templateFactory) { + return { + // $view.load('full.viewName', { template: ..., controller: ..., resolve: ..., async: false, params: ... }) + /** + * @ngdoc function + * @name ui.router.state.$view#load + * @methodOf ui.router.state.$view + * + * @description + * + * @param {string} name name + * @param {object} options option object. + */ + load: function load(name, options) { + var result, defaults = { + template: null, controller: null, view: null, locals: null, notify: true, async: true, params: {} + }; + options = extend(defaults, options); + + if (options.view) { + result = $templateFactory.fromConfig(options.view, options.params, options.locals); + } + if (result && options.notify) { + /** + * @ngdoc event + * @name ui.router.state.$state#$viewContentLoading + * @eventOf ui.router.state.$view + * @eventType broadcast on root scope + * @description + * + * Fired once the view **begins loading**, *before* the DOM is rendered. + * + * @param {Object} event Event object. + * @param {Object} viewConfig The view config properties (template, controller, etc). + * + * @example + * + *
+ * $scope.$on('$viewContentLoading', + * function(event, viewConfig){ + * // Access to all the view config properties. + * // and one special property 'targetView' + * // viewConfig.targetView + * }); + *+ */ + $rootScope.$broadcast('$viewContentLoading', options); + } + return result; + } + }; + } +} + +angular.module('ui.router.state').provider('$view', $ViewProvider); + +/** + * @ngdoc object + * @name ui.router.state.$uiViewScrollProvider + * + * @description + * Provider that returns the {@link ui.router.state.$uiViewScroll} service function. + */ +function $ViewScrollProvider() { + + var useAnchorScroll = false; + + /** + * @ngdoc function + * @name ui.router.state.$uiViewScrollProvider#useAnchorScroll + * @methodOf ui.router.state.$uiViewScrollProvider + * + * @description + * Reverts back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll) service for + * scrolling based on the url anchor. + */ + this.useAnchorScroll = function () { + useAnchorScroll = true; + }; + + /** + * @ngdoc object + * @name ui.router.state.$uiViewScroll + * + * @requires $anchorScroll + * @requires $timeout + * + * @description + * When called with a jqLite element, it scrolls the element into view (after a + * `$timeout` so the DOM has time to refresh). + * + * If you prefer to rely on `$anchorScroll` to scroll the view to the anchor, + * this can be enabled by calling {@link ui.router.state.$uiViewScrollProvider#methods_useAnchorScroll `$uiViewScrollProvider.useAnchorScroll()`}. + */ + this.$get = ['$anchorScroll', '$timeout', function ($anchorScroll, $timeout) { + if (useAnchorScroll) { + return $anchorScroll; + } + + return function ($element) { + $timeout(function () { + $element[0].scrollIntoView(); + }, 0, false); + }; + }]; +} + +angular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider); + +/** + * @ngdoc directive + * @name ui.router.state.directive:ui-view + * + * @requires ui.router.state.$state + * @requires $compile + * @requires $controller + * @requires $injector + * @requires ui.router.state.$uiViewScroll + * @requires $document + * + * @restrict ECA + * + * @description + * The ui-view directive tells $state where to place your templates. + * + * @param {string=} name A view name. The name should be unique amongst the other views in the + * same state. You can have views of the same name that live in different states. + * + * @param {string=} autoscroll It allows you to set the scroll behavior of the browser window + * when a view is populated. By default, $anchorScroll is overridden by ui-router's custom scroll + * service, {@link ui.router.state.$uiViewScroll}. This custom service let's you + * scroll ui-view elements into view when they are populated during a state activation. + * + * *Note: To revert back to old [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll) + * functionality, call `$uiViewScrollProvider.useAnchorScroll()`.* + * + * @param {string=} onload Expression to evaluate whenever the view updates. + * + * @example + * A view can be unnamed or named. + *
+ * + * + * + * + * + *+ * + * You can only have one unnamed view within any template (or root html). If you are only using a + * single view and it is unnamed then you can populate it like so: + *
+ * + * $stateProvider.state("home", { + * template: "+ * + * The above is a convenient shortcut equivalent to specifying your view explicitly with the {@link ui.router.state.$stateProvider#views `views`} + * config property, by name, in this case an empty name: + *HELLO!
" + * }) + *
+ * $stateProvider.state("home", { + * views: { + * "": { + * template: "+ * + * But typically you'll only use the views property if you name your view or have more than one view + * in the same template. There's not really a compelling reason to name a view if its the only one, + * but you could if you wanted, like so: + *HELLO!
" + * } + * } + * }) + *
+ * + *+ *
+ * $stateProvider.state("home", { + * views: { + * "main": { + * template: "+ * + * Really though, you'll use views to set up multiple views: + *HELLO!
" + * } + * } + * }) + *
+ * + * + * + *+ * + *
+ * $stateProvider.state("home", { + * views: { + * "": { + * template: "+ * + * Examples for `autoscroll`: + * + *HELLO!
" + * }, + * "chart": { + * template: "" + * }, + * "data": { + * template: " " + * } + * } + * }) + *
+ * + *+ */ +$ViewDirective.$inject = ['$state', '$injector', '$uiViewScroll', '$interpolate']; +function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate) { + + function getService() { + return ($injector.has) ? function(service) { + return $injector.has(service) ? $injector.get(service) : null; + } : function(service) { + try { + return $injector.get(service); + } catch (e) { + return null; + } + }; + } + + var service = getService(), + $animator = service('$animator'), + $animate = service('$animate'); + + // Returns a set of DOM manipulation functions based on which Angular version + // it should use + function getRenderer(attrs, scope) { + var statics = function() { + return { + enter: function (element, target, cb) { target.after(element); cb(); }, + leave: function (element, cb) { element.remove(); cb(); } + }; + }; + + if ($animate) { + return { + enter: function(element, target, cb) { + var promise = $animate.enter(element, null, target, cb); + if (promise && promise.then) promise.then(cb); + }, + leave: function(element, cb) { + var promise = $animate.leave(element, cb); + if (promise && promise.then) promise.then(cb); + } + }; + } + + if ($animator) { + var animate = $animator && $animator(scope, attrs); + + return { + enter: function(element, target, cb) {animate.enter(element, null, target); cb(); }, + leave: function(element, cb) { animate.leave(element); cb(); } + }; + } + + return statics(); + } + + var directive = { + restrict: 'ECA', + terminal: true, + priority: 400, + transclude: 'element', + compile: function (tElement, tAttrs, $transclude) { + return function (scope, $element, attrs) { + var previousEl, currentEl, currentScope, latestLocals, + onloadExp = attrs.onload || '', + autoScrollExp = attrs.autoscroll, + renderer = getRenderer(attrs, scope); + + scope.$on('$stateChangeSuccess', function() { + updateView(false); + }); + scope.$on('$viewContentLoading', function() { + updateView(false); + }); + + updateView(true); + + function cleanupLastView() { + if (previousEl) { + previousEl.remove(); + previousEl = null; + } + + if (currentScope) { + currentScope.$destroy(); + currentScope = null; + } + + if (currentEl) { + renderer.leave(currentEl, function() { + previousEl = null; + }); + + previousEl = currentEl; + currentEl = null; + } + } + + function updateView(firstTime) { + var newScope, + name = getUiViewName(scope, attrs, $element, $interpolate), + previousLocals = name && $state.$current && $state.$current.locals[name]; + + if (!firstTime && previousLocals === latestLocals) return; // nothing to do + newScope = scope.$new(); + latestLocals = $state.$current.locals[name]; + + var clone = $transclude(newScope, function(clone) { + renderer.enter(clone, $element, function onUiViewEnter() { + if(currentScope) { + currentScope.$emit('$viewContentAnimationEnded'); + } + + if (angular.isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) { + $uiViewScroll(clone); + } + }); + cleanupLastView(); + }); + + currentEl = clone; + currentScope = newScope; + /** + * @ngdoc event + * @name ui.router.state.directive:ui-view#$viewContentLoaded + * @eventOf ui.router.state.directive:ui-view + * @eventType emits on ui-view directive scope + * @description * + * Fired once the view is **loaded**, *after* the DOM is rendered. + * + * @param {Object} event Event object. + */ + currentScope.$emit('$viewContentLoaded'); + currentScope.$eval(onloadExp); + } + }; + } + }; + + return directive; +} + +$ViewDirectiveFill.$inject = ['$compile', '$controller', '$state', '$interpolate']; +function $ViewDirectiveFill ( $compile, $controller, $state, $interpolate) { + return { + restrict: 'ECA', + priority: -400, + compile: function (tElement) { + var initial = tElement.html(); + return function (scope, $element, attrs) { + var current = $state.$current, + name = getUiViewName(scope, attrs, $element, $interpolate), + locals = current && current.locals[name]; + + if (! locals) { + return; + } + + $element.data('$uiView', { name: name, state: locals.$$state }); + $element.html(locals.$template ? locals.$template : initial); + + var link = $compile($element.contents()); + + if (locals.$$controller) { + locals.$scope = scope; + var controller = $controller(locals.$$controller, locals); + if (locals.$$controllerAs) { + scope[locals.$$controllerAs] = controller; + } + $element.data('$ngControllerController', controller); + $element.children().data('$ngControllerController', controller); + } + + link(scope); + }; + } + }; +} + +/** + * Shared ui-view code for both directives: + * Given scope, element, and its attributes, return the view's name + */ +function getUiViewName(scope, attrs, element, $interpolate) { + var name = $interpolate(attrs.uiView || attrs.name || '')(scope); + var inherited = element.inheritedData('$uiView'); + return name.indexOf('@') >= 0 ? name : (name + '@' + (inherited ? inherited.state.name : '')); +} + +angular.module('ui.router.state').directive('uiView', $ViewDirective); +angular.module('ui.router.state').directive('uiView', $ViewDirectiveFill); + +function parseStateRef(ref, current) { + var preparsed = ref.match(/^\s*({[^}]*})\s*$/), parsed; + if (preparsed) ref = current + '(' + preparsed[1] + ')'; + parsed = ref.replace(/\n/g, " ").match(/^([^(]+?)\s*(\((.*)\))?$/); + if (!parsed || parsed.length !== 4) throw new Error("Invalid state ref '" + ref + "'"); + return { state: parsed[1], paramExpr: parsed[3] || null }; +} + +function stateContext(el) { + var stateData = el.parent().inheritedData('$uiView'); + + if (stateData && stateData.state && stateData.state.name) { + return stateData.state; + } +} + +/** + * @ngdoc directive + * @name ui.router.state.directive:ui-sref + * + * @requires ui.router.state.$state + * @requires $timeout + * + * @restrict A + * + * @description + * A directive that binds a link (`` tag) to a state. If the state has an associated + * URL, the directive will automatically generate & update the `href` attribute via + * the {@link ui.router.state.$state#methods_href $state.href()} method. Clicking + * the link will trigger a state transition with optional parameters. + * + * Also middle-clicking, right-clicking, and ctrl-clicking on the link will be + * handled natively by the browser. + * + * You can also use relative state paths within ui-sref, just like the relative + * paths passed to `$state.go()`. You just need to be aware that the path is relative + * to the state that the link lives in, in other words the state that loaded the + * template containing the link. + * + * You can specify options to pass to {@link ui.router.state.$state#go $state.go()} + * using the `ui-sref-opts` attribute. Options are restricted to `location`, `inherit`, + * and `reload`. + * + * @example + * Here's an example of how you'd use ui-sref and how it would compile. If you have the + * following template: + *+ * + * + * + * + * + *
+ * Home | About | Next page + * + *
+ * Home | About | Next page + * + *+ * + * Home + * + * + * @param {string} ui-sref 'stateName' can be any valid absolute or relative state + * @param {Object} ui-sref-opts options to pass to {@link ui.router.state.$state#go $state.go()} + */ +$StateRefDirective.$inject = ['$state', '$timeout']; +function $StateRefDirective($state, $timeout) { + var allowedOptions = ['location', 'inherit', 'reload']; + + return { + restrict: 'A', + require: ['?^uiSrefActive', '?^uiSrefActiveEq'], + link: function(scope, element, attrs, uiSrefActive) { + var ref = parseStateRef(attrs.uiSref, $state.current.name); + var params = null, url = null, base = stateContext(element) || $state.$current; + var newHref = null, isAnchor = element.prop("tagName") === "A"; + var isForm = element[0].nodeName === "FORM"; + var attr = isForm ? "action" : "href", nav = true; + + var options = { relative: base, inherit: true }; + var optionsOverride = scope.$eval(attrs.uiSrefOpts) || {}; + + angular.forEach(allowedOptions, function(option) { + if (option in optionsOverride) { + options[option] = optionsOverride[option]; + } + }); + + var update = function(newVal) { + if (newVal) params = angular.copy(newVal); + if (!nav) return; + + newHref = $state.href(ref.state, params, options); + + var activeDirective = uiSrefActive[1] || uiSrefActive[0]; + if (activeDirective) { + activeDirective.$$setStateInfo(ref.state, params); + } + if (newHref === null) { + nav = false; + return false; + } + attrs.$set(attr, newHref); + }; + + if (ref.paramExpr) { + scope.$watch(ref.paramExpr, function(newVal, oldVal) { + if (newVal !== params) update(newVal); + }, true); + params = angular.copy(scope.$eval(ref.paramExpr)); + } + update(); + + if (isForm) return; + + element.bind("click", function(e) { + var button = e.which || e.button; + if ( !(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || element.attr('target')) ) { + // HACK: This is to allow ng-clicks to be processed before the transition is initiated: + var transition = $timeout(function() { + $state.go(ref.state, params, options); + }); + e.preventDefault(); + + // if the state has no URL, ignore one preventDefault from the directive. + var ignorePreventDefaultCount = isAnchor && !newHref ? 1: 0; + e.preventDefault = function() { + if (ignorePreventDefaultCount-- <= 0) + $timeout.cancel(transition); + }; + } + }); + } + }; +} + +/** + * @ngdoc directive + * @name ui.router.state.directive:ui-sref-active + * + * @requires ui.router.state.$state + * @requires ui.router.state.$stateParams + * @requires $interpolate + * + * @restrict A + * + * @description + * A directive working alongside ui-sref to add classes to an element when the + * related ui-sref directive's state is active, and removing them when it is inactive. + * The primary use-case is to simplify the special appearance of navigation menus + * relying on `ui-sref`, by having the "active" state's menu button appear different, + * distinguishing it from the inactive menu items. + * + * ui-sref-active can live on the same element as ui-sref or on a parent element. The first + * ui-sref-active found at the same level or above the ui-sref will be used. + * + * Will activate when the ui-sref's target state or any child state is active. If you + * need to activate only when the ui-sref target state is active and *not* any of + * it's children, then you will use + * {@link ui.router.state.directive:ui-sref-active-eq ui-sref-active-eq} + * + * @example + * Given the following template: + *
+ *
+ *
+ *
Please click on an element
+ + {{ record.title }} + +