@grafit/era-dependencies 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/package.json +7 -0
  2. package/vendor/fonts/FontAwesome.otf +0 -0
  3. package/vendor/fonts/fontawesome-webfont.eot +0 -0
  4. package/vendor/fonts/fontawesome-webfont.svg +685 -0
  5. package/vendor/fonts/fontawesome-webfont.ttf +0 -0
  6. package/vendor/fonts/fontawesome-webfont.woff +0 -0
  7. package/vendor/fonts/fontawesome-webfont.woff2 +0 -0
  8. package/vendor/fonts/glyphicons-halflings-regular.eot +0 -0
  9. package/vendor/fonts/glyphicons-halflings-regular.svg +288 -0
  10. package/vendor/fonts/glyphicons-halflings-regular.ttf +0 -0
  11. package/vendor/fonts/glyphicons-halflings-regular.woff +0 -0
  12. package/vendor/fonts/glyphicons-halflings-regular.woff2 +0 -0
  13. package/vendor/scripts/angular/angular-cookies.js +322 -0
  14. package/vendor/scripts/angular/angular-file-upload.js +2087 -0
  15. package/vendor/scripts/angular/angular-filter.js +2287 -0
  16. package/vendor/scripts/angular/angular-locale_ru-ru.js +143 -0
  17. package/vendor/scripts/angular/angular-route.js +1069 -0
  18. package/vendor/scripts/angular/angular-sanitize.js +738 -0
  19. package/vendor/scripts/angular/angular-ui-router-0.2.18.js +4539 -0
  20. package/vendor/scripts/angular/angular.js +31768 -0
  21. package/vendor/scripts/angular/datetimepicker.js +578 -0
  22. package/vendor/scripts/angular/datetimepicker.templates.js +30 -0
  23. package/vendor/scripts/angular/mask.min.js +7 -0
  24. package/vendor/scripts/angular/ng-table.js +1518 -0
  25. package/vendor/scripts/angular/select.js +2356 -0
  26. package/vendor/scripts/angular/ui-bootstrap-tpls-2.1.3.js +7536 -0
  27. package/vendor/scripts/angular/uploader.js +3 -0
  28. package/vendor/scripts/bootbox.js +985 -0
  29. package/vendor/scripts/bootstrap.js +2377 -0
  30. package/vendor/scripts/es6-shim.js +3837 -0
  31. package/vendor/scripts/highchart/highcharts-more.src.js +3165 -0
  32. package/vendor/scripts/highchart/highstock.src.js +32008 -0
  33. package/vendor/scripts/highchart/modules/boost.src.js +2721 -0
  34. package/vendor/scripts/highchart/modules/exporting.src.js +951 -0
  35. package/vendor/scripts/jquery/jquery.js +11008 -0
  36. package/vendor/scripts/jquery.datetimepicker.full.js +2911 -0
  37. package/vendor/scripts/keycloak.js +2382 -0
  38. package/vendor/scripts/lodash.js +16733 -0
  39. package/vendor/scripts/moment-with-locales.js +12251 -0
  40. package/vendor/scripts/moment.js +4234 -0
  41. package/vendor/scripts/old/datepicker-ru.js +38 -0
  42. package/vendor/scripts/old/jquery-ui-1.11.1.js +16375 -0
  43. package/vendor/scripts/old/jquery.form.js +1278 -0
  44. package/vendor/scripts/perfect-scrollbar.js +1549 -0
  45. package/vendor/scripts/pickmeup/pickmeup-locales.js +11 -0
  46. package/vendor/scripts/pickmeup/pickmeup.js +1383 -0
  47. package/vendor/scripts/quill.js +9676 -0
  48. package/vendor/scripts/socket.io.min.js +3 -0
  49. package/vendor/scripts/textAngular/angular-spectrum-colorpicker.min.js +2 -0
  50. package/vendor/scripts/textAngular/spectrum.min.js +1 -0
  51. package/vendor/scripts/textAngular/textAngular-dropdownToggle.js +38 -0
  52. package/vendor/scripts/textAngular/textAngular-rangy.min.js +478 -0
  53. package/vendor/scripts/textAngular/textAngular-sanitize.min.js +322 -0
  54. package/vendor/scripts/textAngular/textAngular.min.js +1481 -0
  55. package/vendor/scripts/textAngular/textAngularSetup.js +1013 -0
  56. package/vendor/styles/bootstrap-theme.css +587 -0
  57. package/vendor/styles/bootstrap-theme.css.map +1 -0
  58. package/vendor/styles/bootstrap-theme.min.css +6 -0
  59. package/vendor/styles/bootstrap-theme.min.css.map +1 -0
  60. package/vendor/styles/bootstrap.css +6757 -0
  61. package/vendor/styles/bootstrap.css.map +1 -0
  62. package/vendor/styles/bootstrap.min.css +6 -0
  63. package/vendor/styles/bootstrap.min.css.map +1 -0
  64. package/vendor/styles/datetimepicker.css +115 -0
  65. package/vendor/styles/font-awesome.css +2199 -0
  66. package/vendor/styles/jquery.datetimepicker.min.css +1 -0
  67. package/vendor/styles/ng-table.css +136 -0
  68. package/vendor/styles/normalize.css +424 -0
  69. package/vendor/styles/perfect-scrollbar.css +165 -0
  70. package/vendor/styles/pickmeup.css +137 -0
  71. package/vendor/styles/spectrum.min.css +1 -0
  72. package/vendor/styles/textAngular.css +193 -0
@@ -0,0 +1,1069 @@
1
+ /**
2
+ * @license AngularJS v1.5.8
3
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
4
+ * License: MIT
5
+ */
6
+ (function(window, angular) {'use strict';
7
+
8
+ /* global shallowCopy: true */
9
+
10
+ /**
11
+ * Creates a shallow copy of an object, an array or a primitive.
12
+ *
13
+ * Assumes that there are no proto properties for objects.
14
+ */
15
+ function shallowCopy(src, dst) {
16
+ if (isArray(src)) {
17
+ dst = dst || [];
18
+
19
+ for (var i = 0, ii = src.length; i < ii; i++) {
20
+ dst[i] = src[i];
21
+ }
22
+ } else if (isObject(src)) {
23
+ dst = dst || {};
24
+
25
+ for (var key in src) {
26
+ if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
27
+ dst[key] = src[key];
28
+ }
29
+ }
30
+ }
31
+
32
+ return dst || src;
33
+ }
34
+
35
+ /* global shallowCopy: false */
36
+
37
+ // There are necessary for `shallowCopy()` (included via `src/shallowCopy.js`).
38
+ // They are initialized inside the `$RouteProvider`, to ensure `window.angular` is available.
39
+ var isArray;
40
+ var isObject;
41
+
42
+ /**
43
+ * @ngdoc module
44
+ * @name ngRoute
45
+ * @description
46
+ *
47
+ * # ngRoute
48
+ *
49
+ * The `ngRoute` module provides routing and deeplinking services and directives for angular apps.
50
+ *
51
+ * ## Example
52
+ * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
53
+ *
54
+ *
55
+ * <div doc-module-components="ngRoute"></div>
56
+ */
57
+ /* global -ngRouteModule */
58
+ var ngRouteModule = angular.module('ngRoute', ['ng']).
59
+ provider('$route', $RouteProvider),
60
+ $routeMinErr = angular.$$minErr('ngRoute');
61
+
62
+ /**
63
+ * @ngdoc provider
64
+ * @name $routeProvider
65
+ *
66
+ * @description
67
+ *
68
+ * Used for configuring routes.
69
+ *
70
+ * ## Example
71
+ * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
72
+ *
73
+ * ## Dependencies
74
+ * Requires the {@link ngRoute `ngRoute`} module to be installed.
75
+ */
76
+ function $RouteProvider() {
77
+ isArray = angular.isArray;
78
+ isObject = angular.isObject;
79
+
80
+ function inherit(parent, extra) {
81
+ return angular.extend(Object.create(parent), extra);
82
+ }
83
+
84
+ var routes = {};
85
+
86
+ /**
87
+ * @ngdoc method
88
+ * @name $routeProvider#when
89
+ *
90
+ * @param {string} path Route path (matched against `$location.path`). If `$location.path`
91
+ * contains redundant trailing slash or is missing one, the route will still match and the
92
+ * `$location.path` will be updated to add or drop the trailing slash to exactly match the
93
+ * route definition.
94
+ *
95
+ * * `path` can contain named groups starting with a colon: e.g. `:name`. All characters up
96
+ * to the next slash are matched and stored in `$routeParams` under the given `name`
97
+ * when the route matches.
98
+ * * `path` can contain named groups starting with a colon and ending with a star:
99
+ * e.g.`:name*`. All characters are eagerly stored in `$routeParams` under the given `name`
100
+ * when the route matches.
101
+ * * `path` can contain optional named groups with a question mark: e.g.`:name?`.
102
+ *
103
+ * For example, routes like `/color/:color/largecode/:largecode*\/edit` will match
104
+ * `/color/brown/largecode/code/with/slashes/edit` and extract:
105
+ *
106
+ * * `color: brown`
107
+ * * `largecode: code/with/slashes`.
108
+ *
109
+ *
110
+ * @param {Object} route Mapping information to be assigned to `$route.current` on route
111
+ * match.
112
+ *
113
+ * Object properties:
114
+ *
115
+ * - `controller` – `{(string|function()=}` – Controller fn that should be associated with
116
+ * newly created scope or the name of a {@link angular.Module#controller registered
117
+ * controller} if passed as a string.
118
+ * - `controllerAs` – `{string=}` – An identifier name for a reference to the controller.
119
+ * If present, the controller will be published to scope under the `controllerAs` name.
120
+ * - `template` – `{string=|function()=}` – html template as a string or a function that
121
+ * returns an html template as a string which should be used by {@link
122
+ * ngRoute.directive:ngView ngView} or {@link ng.directive:ngInclude ngInclude} directives.
123
+ * This property takes precedence over `templateUrl`.
124
+ *
125
+ * If `template` is a function, it will be called with the following parameters:
126
+ *
127
+ * - `{Array.<Object>}` - route parameters extracted from the current
128
+ * `$location.path()` by applying the current route
129
+ *
130
+ * - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html
131
+ * template that should be used by {@link ngRoute.directive:ngView ngView}.
132
+ *
133
+ * If `templateUrl` is a function, it will be called with the following parameters:
134
+ *
135
+ * - `{Array.<Object>}` - route parameters extracted from the current
136
+ * `$location.path()` by applying the current route
137
+ *
138
+ * - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should
139
+ * be injected into the controller. If any of these dependencies are promises, the router
140
+ * will wait for them all to be resolved or one to be rejected before the controller is
141
+ * instantiated.
142
+ * If all the promises are resolved successfully, the values of the resolved promises are
143
+ * injected and {@link ngRoute.$route#$routeChangeSuccess $routeChangeSuccess} event is
144
+ * fired. If any of the promises are rejected the
145
+ * {@link ngRoute.$route#$routeChangeError $routeChangeError} event is fired.
146
+ * For easier access to the resolved dependencies from the template, the `resolve` map will
147
+ * be available on the scope of the route, under `$resolve` (by default) or a custom name
148
+ * specified by the `resolveAs` property (see below). This can be particularly useful, when
149
+ * working with {@link angular.Module#component components} as route templates.<br />
150
+ * <div class="alert alert-warning">
151
+ * **Note:** If your scope already contains a property with this name, it will be hidden
152
+ * or overwritten. Make sure, you specify an appropriate name for this property, that
153
+ * does not collide with other properties on the scope.
154
+ * </div>
155
+ * The map object is:
156
+ *
157
+ * - `key` – `{string}`: a name of a dependency to be injected into the controller.
158
+ * - `factory` - `{string|function}`: If `string` then it is an alias for a service.
159
+ * Otherwise if function, then it is {@link auto.$injector#invoke injected}
160
+ * and the return value is treated as the dependency. If the result is a promise, it is
161
+ * resolved before its value is injected into the controller. Be aware that
162
+ * `ngRoute.$routeParams` will still refer to the previous route within these resolve
163
+ * functions. Use `$route.current.params` to access the new route parameters, instead.
164
+ *
165
+ * - `resolveAs` - `{string=}` - The name under which the `resolve` map will be available on
166
+ * the scope of the route. If omitted, defaults to `$resolve`.
167
+ *
168
+ * - `redirectTo` – `{(string|function())=}` – value to update
169
+ * {@link ng.$location $location} path with and trigger route redirection.
170
+ *
171
+ * If `redirectTo` is a function, it will be called with the following parameters:
172
+ *
173
+ * - `{Object.<string>}` - route parameters extracted from the current
174
+ * `$location.path()` by applying the current route templateUrl.
175
+ * - `{string}` - current `$location.path()`
176
+ * - `{Object}` - current `$location.search()`
177
+ *
178
+ * The custom `redirectTo` function is expected to return a string which will be used
179
+ * to update `$location.path()` and `$location.search()`.
180
+ *
181
+ * - `[reloadOnSearch=true]` - `{boolean=}` - reload route when only `$location.search()`
182
+ * or `$location.hash()` changes.
183
+ *
184
+ * If the option is set to `false` and url in the browser changes, then
185
+ * `$routeUpdate` event is broadcasted on the root scope.
186
+ *
187
+ * - `[caseInsensitiveMatch=false]` - `{boolean=}` - match routes without being case sensitive
188
+ *
189
+ * If the option is set to `true`, then the particular route can be matched without being
190
+ * case sensitive
191
+ *
192
+ * @returns {Object} self
193
+ *
194
+ * @description
195
+ * Adds a new route definition to the `$route` service.
196
+ */
197
+ this.when = function(path, route) {
198
+ //copy original route object to preserve params inherited from proto chain
199
+ var routeCopy = shallowCopy(route);
200
+ if (angular.isUndefined(routeCopy.reloadOnSearch)) {
201
+ routeCopy.reloadOnSearch = true;
202
+ }
203
+ if (angular.isUndefined(routeCopy.caseInsensitiveMatch)) {
204
+ routeCopy.caseInsensitiveMatch = this.caseInsensitiveMatch;
205
+ }
206
+ routes[path] = angular.extend(
207
+ routeCopy,
208
+ path && pathRegExp(path, routeCopy)
209
+ );
210
+
211
+ // create redirection for trailing slashes
212
+ if (path) {
213
+ var redirectPath = (path[path.length - 1] == '/')
214
+ ? path.substr(0, path.length - 1)
215
+ : path + '/';
216
+
217
+ routes[redirectPath] = angular.extend(
218
+ {redirectTo: path},
219
+ pathRegExp(redirectPath, routeCopy)
220
+ );
221
+ }
222
+
223
+ return this;
224
+ };
225
+
226
+ /**
227
+ * @ngdoc property
228
+ * @name $routeProvider#caseInsensitiveMatch
229
+ * @description
230
+ *
231
+ * A boolean property indicating if routes defined
232
+ * using this provider should be matched using a case insensitive
233
+ * algorithm. Defaults to `false`.
234
+ */
235
+ this.caseInsensitiveMatch = false;
236
+
237
+ /**
238
+ * @param path {string} path
239
+ * @param opts {Object} options
240
+ * @return {?Object}
241
+ *
242
+ * @description
243
+ * Normalizes the given path, returning a regular expression
244
+ * and the original path.
245
+ *
246
+ * Inspired by pathRexp in visionmedia/express/lib/utils.js.
247
+ */
248
+ function pathRegExp(path, opts) {
249
+ var insensitive = opts.caseInsensitiveMatch,
250
+ ret = {
251
+ originalPath: path,
252
+ regexp: path
253
+ },
254
+ keys = ret.keys = [];
255
+
256
+ path = path
257
+ .replace(/([().])/g, '\\$1')
258
+ .replace(/(\/)?:(\w+)(\*\?|[\?\*])?/g, function(_, slash, key, option) {
259
+ var optional = (option === '?' || option === '*?') ? '?' : null;
260
+ var star = (option === '*' || option === '*?') ? '*' : null;
261
+ keys.push({ name: key, optional: !!optional });
262
+ slash = slash || '';
263
+ return ''
264
+ + (optional ? '' : slash)
265
+ + '(?:'
266
+ + (optional ? slash : '')
267
+ + (star && '(.+?)' || '([^/]+)')
268
+ + (optional || '')
269
+ + ')'
270
+ + (optional || '');
271
+ })
272
+ .replace(/([\/$\*])/g, '\\$1');
273
+
274
+ ret.regexp = new RegExp('^' + path + '$', insensitive ? 'i' : '');
275
+ return ret;
276
+ }
277
+
278
+ /**
279
+ * @ngdoc method
280
+ * @name $routeProvider#otherwise
281
+ *
282
+ * @description
283
+ * Sets route definition that will be used on route change when no other route definition
284
+ * is matched.
285
+ *
286
+ * @param {Object|string} params Mapping information to be assigned to `$route.current`.
287
+ * If called with a string, the value maps to `redirectTo`.
288
+ * @returns {Object} self
289
+ */
290
+ this.otherwise = function(params) {
291
+ if (typeof params === 'string') {
292
+ params = {redirectTo: params};
293
+ }
294
+ this.when(null, params);
295
+ return this;
296
+ };
297
+
298
+
299
+ this.$get = ['$rootScope',
300
+ '$location',
301
+ '$routeParams',
302
+ '$q',
303
+ '$injector',
304
+ '$templateRequest',
305
+ '$sce',
306
+ function($rootScope, $location, $routeParams, $q, $injector, $templateRequest, $sce) {
307
+
308
+ /**
309
+ * @ngdoc service
310
+ * @name $route
311
+ * @requires $location
312
+ * @requires $routeParams
313
+ *
314
+ * @property {Object} current Reference to the current route definition.
315
+ * The route definition contains:
316
+ *
317
+ * - `controller`: The controller constructor as defined in the route definition.
318
+ * - `locals`: A map of locals which is used by {@link ng.$controller $controller} service for
319
+ * controller instantiation. The `locals` contain
320
+ * the resolved values of the `resolve` map. Additionally the `locals` also contain:
321
+ *
322
+ * - `$scope` - The current route scope.
323
+ * - `$template` - The current route template HTML.
324
+ *
325
+ * The `locals` will be assigned to the route scope's `$resolve` property. You can override
326
+ * the property name, using `resolveAs` in the route definition. See
327
+ * {@link ngRoute.$routeProvider $routeProvider} for more info.
328
+ *
329
+ * @property {Object} routes Object with all route configuration Objects as its properties.
330
+ *
331
+ * @description
332
+ * `$route` is used for deep-linking URLs to controllers and views (HTML partials).
333
+ * It watches `$location.url()` and tries to map the path to an existing route definition.
334
+ *
335
+ * Requires the {@link ngRoute `ngRoute`} module to be installed.
336
+ *
337
+ * You can define routes through {@link ngRoute.$routeProvider $routeProvider}'s API.
338
+ *
339
+ * The `$route` service is typically used in conjunction with the
340
+ * {@link ngRoute.directive:ngView `ngView`} directive and the
341
+ * {@link ngRoute.$routeParams `$routeParams`} service.
342
+ *
343
+ * @example
344
+ * This example shows how changing the URL hash causes the `$route` to match a route against the
345
+ * URL, and the `ngView` pulls in the partial.
346
+ *
347
+ * <example name="$route-service" module="ngRouteExample"
348
+ * deps="angular-route.js" fixBase="true">
349
+ * <file name="index.html">
350
+ * <div ng-controller="MainController">
351
+ * Choose:
352
+ * <a href="Book/Moby">Moby</a> |
353
+ * <a href="Book/Moby/ch/1">Moby: Ch1</a> |
354
+ * <a href="Book/Gatsby">Gatsby</a> |
355
+ * <a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
356
+ * <a href="Book/Scarlet">Scarlet Letter</a><br/>
357
+ *
358
+ * <div ng-view></div>
359
+ *
360
+ * <hr />
361
+ *
362
+ * <pre>$location.path() = {{$location.path()}}</pre>
363
+ * <pre>$route.current.templateUrl = {{$route.current.templateUrl}}</pre>
364
+ * <pre>$route.current.params = {{$route.current.params}}</pre>
365
+ * <pre>$route.current.scope.name = {{$route.current.scope.name}}</pre>
366
+ * <pre>$routeParams = {{$routeParams}}</pre>
367
+ * </div>
368
+ * </file>
369
+ *
370
+ * <file name="book.html">
371
+ * controller: {{name}}<br />
372
+ * Book Id: {{params.bookId}}<br />
373
+ * </file>
374
+ *
375
+ * <file name="chapter.html">
376
+ * controller: {{name}}<br />
377
+ * Book Id: {{params.bookId}}<br />
378
+ * Chapter Id: {{params.chapterId}}
379
+ * </file>
380
+ *
381
+ * <file name="script.js">
382
+ * angular.module('ngRouteExample', ['ngRoute'])
383
+ *
384
+ * .controller('MainController', function($scope, $route, $routeParams, $location) {
385
+ * $scope.$route = $route;
386
+ * $scope.$location = $location;
387
+ * $scope.$routeParams = $routeParams;
388
+ * })
389
+ *
390
+ * .controller('BookController', function($scope, $routeParams) {
391
+ * $scope.name = "BookController";
392
+ * $scope.params = $routeParams;
393
+ * })
394
+ *
395
+ * .controller('ChapterController', function($scope, $routeParams) {
396
+ * $scope.name = "ChapterController";
397
+ * $scope.params = $routeParams;
398
+ * })
399
+ *
400
+ * .config(function($routeProvider, $locationProvider) {
401
+ * $routeProvider
402
+ * .when('/Book/:bookId', {
403
+ * templateUrl: 'book.html',
404
+ * controller: 'BookController',
405
+ * resolve: {
406
+ * // I will cause a 1 second delay
407
+ * delay: function($q, $timeout) {
408
+ * var delay = $q.defer();
409
+ * $timeout(delay.resolve, 1000);
410
+ * return delay.promise;
411
+ * }
412
+ * }
413
+ * })
414
+ * .when('/Book/:bookId/ch/:chapterId', {
415
+ * templateUrl: 'chapter.html',
416
+ * controller: 'ChapterController'
417
+ * });
418
+ *
419
+ * // configure html5 to get links working on jsfiddle
420
+ * $locationProvider.html5Mode(true);
421
+ * });
422
+ *
423
+ * </file>
424
+ *
425
+ * <file name="protractor.js" type="protractor">
426
+ * it('should load and compile correct template', function() {
427
+ * element(by.linkText('Moby: Ch1')).click();
428
+ * var content = element(by.css('[ng-view]')).getText();
429
+ * expect(content).toMatch(/controller\: ChapterController/);
430
+ * expect(content).toMatch(/Book Id\: Moby/);
431
+ * expect(content).toMatch(/Chapter Id\: 1/);
432
+ *
433
+ * element(by.partialLinkText('Scarlet')).click();
434
+ *
435
+ * content = element(by.css('[ng-view]')).getText();
436
+ * expect(content).toMatch(/controller\: BookController/);
437
+ * expect(content).toMatch(/Book Id\: Scarlet/);
438
+ * });
439
+ * </file>
440
+ * </example>
441
+ */
442
+
443
+ /**
444
+ * @ngdoc event
445
+ * @name $route#$routeChangeStart
446
+ * @eventType broadcast on root scope
447
+ * @description
448
+ * Broadcasted before a route change. At this point the route services starts
449
+ * resolving all of the dependencies needed for the route change to occur.
450
+ * Typically this involves fetching the view template as well as any dependencies
451
+ * defined in `resolve` route property. Once all of the dependencies are resolved
452
+ * `$routeChangeSuccess` is fired.
453
+ *
454
+ * The route change (and the `$location` change that triggered it) can be prevented
455
+ * by calling `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on}
456
+ * for more details about event object.
457
+ *
458
+ * @param {Object} angularEvent Synthetic event object.
459
+ * @param {Route} next Future route information.
460
+ * @param {Route} current Current route information.
461
+ */
462
+
463
+ /**
464
+ * @ngdoc event
465
+ * @name $route#$routeChangeSuccess
466
+ * @eventType broadcast on root scope
467
+ * @description
468
+ * Broadcasted after a route change has happened successfully.
469
+ * The `resolve` dependencies are now available in the `current.locals` property.
470
+ *
471
+ * {@link ngRoute.directive:ngView ngView} listens for the directive
472
+ * to instantiate the controller and render the view.
473
+ *
474
+ * @param {Object} angularEvent Synthetic event object.
475
+ * @param {Route} current Current route information.
476
+ * @param {Route|Undefined} previous Previous route information, or undefined if current is
477
+ * first route entered.
478
+ */
479
+
480
+ /**
481
+ * @ngdoc event
482
+ * @name $route#$routeChangeError
483
+ * @eventType broadcast on root scope
484
+ * @description
485
+ * Broadcasted if any of the resolve promises are rejected.
486
+ *
487
+ * @param {Object} angularEvent Synthetic event object
488
+ * @param {Route} current Current route information.
489
+ * @param {Route} previous Previous route information.
490
+ * @param {Route} rejection Rejection of the promise. Usually the error of the failed promise.
491
+ */
492
+
493
+ /**
494
+ * @ngdoc event
495
+ * @name $route#$routeUpdate
496
+ * @eventType broadcast on root scope
497
+ * @description
498
+ * The `reloadOnSearch` property has been set to false, and we are reusing the same
499
+ * instance of the Controller.
500
+ *
501
+ * @param {Object} angularEvent Synthetic event object
502
+ * @param {Route} current Current/previous route information.
503
+ */
504
+
505
+ var forceReload = false,
506
+ preparedRoute,
507
+ preparedRouteIsUpdateOnly,
508
+ $route = {
509
+ routes: routes,
510
+
511
+ /**
512
+ * @ngdoc method
513
+ * @name $route#reload
514
+ *
515
+ * @description
516
+ * Causes `$route` service to reload the current route even if
517
+ * {@link ng.$location $location} hasn't changed.
518
+ *
519
+ * As a result of that, {@link ngRoute.directive:ngView ngView}
520
+ * creates new scope and reinstantiates the controller.
521
+ */
522
+ reload: function() {
523
+ forceReload = true;
524
+
525
+ var fakeLocationEvent = {
526
+ defaultPrevented: false,
527
+ preventDefault: function fakePreventDefault() {
528
+ this.defaultPrevented = true;
529
+ forceReload = false;
530
+ }
531
+ };
532
+
533
+ $rootScope.$evalAsync(function() {
534
+ prepareRoute(fakeLocationEvent);
535
+ if (!fakeLocationEvent.defaultPrevented) commitRoute();
536
+ });
537
+ },
538
+
539
+ /**
540
+ * @ngdoc method
541
+ * @name $route#updateParams
542
+ *
543
+ * @description
544
+ * Causes `$route` service to update the current URL, replacing
545
+ * current route parameters with those specified in `newParams`.
546
+ * Provided property names that match the route's path segment
547
+ * definitions will be interpolated into the location's path, while
548
+ * remaining properties will be treated as query params.
549
+ *
550
+ * @param {!Object<string, string>} newParams mapping of URL parameter names to values
551
+ */
552
+ updateParams: function(newParams) {
553
+ if (this.current && this.current.$$route) {
554
+ newParams = angular.extend({}, this.current.params, newParams);
555
+ $location.path(interpolate(this.current.$$route.originalPath, newParams));
556
+ // interpolate modifies newParams, only query params are left
557
+ $location.search(newParams);
558
+ } else {
559
+ throw $routeMinErr('norout', 'Tried updating route when with no current route');
560
+ }
561
+ }
562
+ };
563
+
564
+ $rootScope.$on('$locationChangeStart', prepareRoute);
565
+ $rootScope.$on('$locationChangeSuccess', commitRoute);
566
+
567
+ return $route;
568
+
569
+ /////////////////////////////////////////////////////
570
+
571
+ /**
572
+ * @param on {string} current url
573
+ * @param route {Object} route regexp to match the url against
574
+ * @return {?Object}
575
+ *
576
+ * @description
577
+ * Check if the route matches the current url.
578
+ *
579
+ * Inspired by match in
580
+ * visionmedia/express/lib/router/router.js.
581
+ */
582
+ function switchRouteMatcher(on, route) {
583
+ var keys = route.keys,
584
+ params = {};
585
+
586
+ if (!route.regexp) return null;
587
+
588
+ var m = route.regexp.exec(on);
589
+ if (!m) return null;
590
+
591
+ for (var i = 1, len = m.length; i < len; ++i) {
592
+ var key = keys[i - 1];
593
+
594
+ var val = m[i];
595
+
596
+ if (key && val) {
597
+ params[key.name] = val;
598
+ }
599
+ }
600
+ return params;
601
+ }
602
+
603
+ function prepareRoute($locationEvent) {
604
+ var lastRoute = $route.current;
605
+
606
+ preparedRoute = parseRoute();
607
+ preparedRouteIsUpdateOnly = preparedRoute && lastRoute && preparedRoute.$$route === lastRoute.$$route
608
+ && angular.equals(preparedRoute.pathParams, lastRoute.pathParams)
609
+ && !preparedRoute.reloadOnSearch && !forceReload;
610
+
611
+ if (!preparedRouteIsUpdateOnly && (lastRoute || preparedRoute)) {
612
+ if ($rootScope.$broadcast('$routeChangeStart', preparedRoute, lastRoute).defaultPrevented) {
613
+ if ($locationEvent) {
614
+ $locationEvent.preventDefault();
615
+ }
616
+ }
617
+ }
618
+ }
619
+
620
+ function commitRoute() {
621
+ var lastRoute = $route.current;
622
+ var nextRoute = preparedRoute;
623
+
624
+ if (preparedRouteIsUpdateOnly) {
625
+ lastRoute.params = nextRoute.params;
626
+ angular.copy(lastRoute.params, $routeParams);
627
+ $rootScope.$broadcast('$routeUpdate', lastRoute);
628
+ } else if (nextRoute || lastRoute) {
629
+ forceReload = false;
630
+ $route.current = nextRoute;
631
+ if (nextRoute) {
632
+ if (nextRoute.redirectTo) {
633
+ if (angular.isString(nextRoute.redirectTo)) {
634
+ $location.path(interpolate(nextRoute.redirectTo, nextRoute.params)).search(nextRoute.params)
635
+ .replace();
636
+ } else {
637
+ $location.url(nextRoute.redirectTo(nextRoute.pathParams, $location.path(), $location.search()))
638
+ .replace();
639
+ }
640
+ }
641
+ }
642
+
643
+ $q.when(nextRoute).
644
+ then(resolveLocals).
645
+ then(function(locals) {
646
+ // after route change
647
+ if (nextRoute == $route.current) {
648
+ if (nextRoute) {
649
+ nextRoute.locals = locals;
650
+ angular.copy(nextRoute.params, $routeParams);
651
+ }
652
+ $rootScope.$broadcast('$routeChangeSuccess', nextRoute, lastRoute);
653
+ }
654
+ }, function(error) {
655
+ if (nextRoute == $route.current) {
656
+ $rootScope.$broadcast('$routeChangeError', nextRoute, lastRoute, error);
657
+ }
658
+ });
659
+ }
660
+ }
661
+
662
+ function resolveLocals(route) {
663
+ if (route) {
664
+ var locals = angular.extend({}, route.resolve);
665
+ angular.forEach(locals, function(value, key) {
666
+ locals[key] = angular.isString(value) ?
667
+ $injector.get(value) :
668
+ $injector.invoke(value, null, null, key);
669
+ });
670
+ var template = getTemplateFor(route);
671
+ if (angular.isDefined(template)) {
672
+ locals['$template'] = template;
673
+ }
674
+ return $q.all(locals);
675
+ }
676
+ }
677
+
678
+
679
+ function getTemplateFor(route) {
680
+ var template, templateUrl;
681
+ if (angular.isDefined(template = route.template)) {
682
+ if (angular.isFunction(template)) {
683
+ template = template(route.params);
684
+ }
685
+ } else if (angular.isDefined(templateUrl = route.templateUrl)) {
686
+ if (angular.isFunction(templateUrl)) {
687
+ templateUrl = templateUrl(route.params);
688
+ }
689
+ if (angular.isDefined(templateUrl)) {
690
+ route.loadedTemplateUrl = $sce.valueOf(templateUrl);
691
+ template = $templateRequest(templateUrl);
692
+ }
693
+ }
694
+ return template;
695
+ }
696
+
697
+
698
+ /**
699
+ * @returns {Object} the current active route, by matching it against the URL
700
+ */
701
+ function parseRoute() {
702
+ // Match a route
703
+ var params, match;
704
+ angular.forEach(routes, function(route, path) {
705
+ if (!match && (params = switchRouteMatcher($location.path(), route))) {
706
+ match = inherit(route, {
707
+ params: angular.extend({}, $location.search(), params),
708
+ pathParams: params});
709
+ match.$$route = route;
710
+ }
711
+ });
712
+ // No route matched; fallback to "otherwise" route
713
+ return match || routes[null] && inherit(routes[null], {params: {}, pathParams:{}});
714
+ }
715
+
716
+ /**
717
+ * @returns {string} interpolation of the redirect path with the parameters
718
+ */
719
+ function interpolate(string, params) {
720
+ var result = [];
721
+ angular.forEach((string || '').split(':'), function(segment, i) {
722
+ if (i === 0) {
723
+ result.push(segment);
724
+ } else {
725
+ var segmentMatch = segment.match(/(\w+)(?:[?*])?(.*)/);
726
+ var key = segmentMatch[1];
727
+ result.push(params[key]);
728
+ result.push(segmentMatch[2] || '');
729
+ delete params[key];
730
+ }
731
+ });
732
+ return result.join('');
733
+ }
734
+ }];
735
+ }
736
+
737
+ ngRouteModule.provider('$routeParams', $RouteParamsProvider);
738
+
739
+
740
+ /**
741
+ * @ngdoc service
742
+ * @name $routeParams
743
+ * @requires $route
744
+ *
745
+ * @description
746
+ * The `$routeParams` service allows you to retrieve the current set of route parameters.
747
+ *
748
+ * Requires the {@link ngRoute `ngRoute`} module to be installed.
749
+ *
750
+ * The route parameters are a combination of {@link ng.$location `$location`}'s
751
+ * {@link ng.$location#search `search()`} and {@link ng.$location#path `path()`}.
752
+ * The `path` parameters are extracted when the {@link ngRoute.$route `$route`} path is matched.
753
+ *
754
+ * In case of parameter name collision, `path` params take precedence over `search` params.
755
+ *
756
+ * The service guarantees that the identity of the `$routeParams` object will remain unchanged
757
+ * (but its properties will likely change) even when a route change occurs.
758
+ *
759
+ * Note that the `$routeParams` are only updated *after* a route change completes successfully.
760
+ * This means that you cannot rely on `$routeParams` being correct in route resolve functions.
761
+ * Instead you can use `$route.current.params` to access the new route's parameters.
762
+ *
763
+ * @example
764
+ * ```js
765
+ * // Given:
766
+ * // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
767
+ * // Route: /Chapter/:chapterId/Section/:sectionId
768
+ * //
769
+ * // Then
770
+ * $routeParams ==> {chapterId:'1', sectionId:'2', search:'moby'}
771
+ * ```
772
+ */
773
+ function $RouteParamsProvider() {
774
+ this.$get = function() { return {}; };
775
+ }
776
+
777
+ ngRouteModule.directive('ngView', ngViewFactory);
778
+ ngRouteModule.directive('ngView', ngViewFillContentFactory);
779
+
780
+
781
+ /**
782
+ * @ngdoc directive
783
+ * @name ngView
784
+ * @restrict ECA
785
+ *
786
+ * @description
787
+ * # Overview
788
+ * `ngView` is a directive that complements the {@link ngRoute.$route $route} service by
789
+ * including the rendered template of the current route into the main layout (`index.html`) file.
790
+ * Every time the current route changes, the included view changes with it according to the
791
+ * configuration of the `$route` service.
792
+ *
793
+ * Requires the {@link ngRoute `ngRoute`} module to be installed.
794
+ *
795
+ * @animations
796
+ * | Animation | Occurs |
797
+ * |----------------------------------|-------------------------------------|
798
+ * | {@link ng.$animate#enter enter} | when the new element is inserted to the DOM |
799
+ * | {@link ng.$animate#leave leave} | when the old element is removed from to the DOM |
800
+ *
801
+ * The enter and leave animation occur concurrently.
802
+ *
803
+ * @knownIssue If `ngView` is contained in an asynchronously loaded template (e.g. in another
804
+ * directive's templateUrl or in a template loaded using `ngInclude`), then you need to
805
+ * make sure that `$route` is instantiated in time to capture the initial
806
+ * `$locationChangeStart` event and load the appropriate view. One way to achieve this
807
+ * is to have it as a dependency in a `.run` block:
808
+ * `myModule.run(['$route', function() {}]);`
809
+ *
810
+ * @scope
811
+ * @priority 400
812
+ * @param {string=} onload Expression to evaluate whenever the view updates.
813
+ *
814
+ * @param {string=} autoscroll Whether `ngView` should call {@link ng.$anchorScroll
815
+ * $anchorScroll} to scroll the viewport after the view is updated.
816
+ *
817
+ * - If the attribute is not set, disable scrolling.
818
+ * - If the attribute is set without value, enable scrolling.
819
+ * - Otherwise enable scrolling only if the `autoscroll` attribute value evaluated
820
+ * as an expression yields a truthy value.
821
+ * @example
822
+ <example name="ngView-directive" module="ngViewExample"
823
+ deps="angular-route.js;angular-animate.js"
824
+ animations="true" fixBase="true">
825
+ <file name="index.html">
826
+ <div ng-controller="MainCtrl as main">
827
+ Choose:
828
+ <a href="Book/Moby">Moby</a> |
829
+ <a href="Book/Moby/ch/1">Moby: Ch1</a> |
830
+ <a href="Book/Gatsby">Gatsby</a> |
831
+ <a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
832
+ <a href="Book/Scarlet">Scarlet Letter</a><br/>
833
+
834
+ <div class="view-animate-container">
835
+ <div ng-view class="view-animate"></div>
836
+ </div>
837
+ <hr />
838
+
839
+ <pre>$location.path() = {{main.$location.path()}}</pre>
840
+ <pre>$route.current.templateUrl = {{main.$route.current.templateUrl}}</pre>
841
+ <pre>$route.current.params = {{main.$route.current.params}}</pre>
842
+ <pre>$routeParams = {{main.$routeParams}}</pre>
843
+ </div>
844
+ </file>
845
+
846
+ <file name="book.html">
847
+ <div>
848
+ controller: {{book.name}}<br />
849
+ Book Id: {{book.params.bookId}}<br />
850
+ </div>
851
+ </file>
852
+
853
+ <file name="chapter.html">
854
+ <div>
855
+ controller: {{chapter.name}}<br />
856
+ Book Id: {{chapter.params.bookId}}<br />
857
+ Chapter Id: {{chapter.params.chapterId}}
858
+ </div>
859
+ </file>
860
+
861
+ <file name="animations.css">
862
+ .view-animate-container {
863
+ position:relative;
864
+ height:100px!important;
865
+ background:white;
866
+ border:1px solid black;
867
+ height:40px;
868
+ overflow:hidden;
869
+ }
870
+
871
+ .view-animate {
872
+ padding:10px;
873
+ }
874
+
875
+ .view-animate.ng-enter, .view-animate.ng-leave {
876
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
877
+
878
+ display:block;
879
+ width:100%;
880
+ border-left:1px solid black;
881
+
882
+ position:absolute;
883
+ top:0;
884
+ left:0;
885
+ right:0;
886
+ bottom:0;
887
+ padding:10px;
888
+ }
889
+
890
+ .view-animate.ng-enter {
891
+ left:100%;
892
+ }
893
+ .view-animate.ng-enter.ng-enter-active {
894
+ left:0;
895
+ }
896
+ .view-animate.ng-leave.ng-leave-active {
897
+ left:-100%;
898
+ }
899
+ </file>
900
+
901
+ <file name="script.js">
902
+ angular.module('ngViewExample', ['ngRoute', 'ngAnimate'])
903
+ .config(['$routeProvider', '$locationProvider',
904
+ function($routeProvider, $locationProvider) {
905
+ $routeProvider
906
+ .when('/Book/:bookId', {
907
+ templateUrl: 'book.html',
908
+ controller: 'BookCtrl',
909
+ controllerAs: 'book'
910
+ })
911
+ .when('/Book/:bookId/ch/:chapterId', {
912
+ templateUrl: 'chapter.html',
913
+ controller: 'ChapterCtrl',
914
+ controllerAs: 'chapter'
915
+ });
916
+
917
+ $locationProvider.html5Mode(true);
918
+ }])
919
+ .controller('MainCtrl', ['$route', '$routeParams', '$location',
920
+ function($route, $routeParams, $location) {
921
+ this.$route = $route;
922
+ this.$location = $location;
923
+ this.$routeParams = $routeParams;
924
+ }])
925
+ .controller('BookCtrl', ['$routeParams', function($routeParams) {
926
+ this.name = "BookCtrl";
927
+ this.params = $routeParams;
928
+ }])
929
+ .controller('ChapterCtrl', ['$routeParams', function($routeParams) {
930
+ this.name = "ChapterCtrl";
931
+ this.params = $routeParams;
932
+ }]);
933
+
934
+ </file>
935
+
936
+ <file name="protractor.js" type="protractor">
937
+ it('should load and compile correct template', function() {
938
+ element(by.linkText('Moby: Ch1')).click();
939
+ var content = element(by.css('[ng-view]')).getText();
940
+ expect(content).toMatch(/controller\: ChapterCtrl/);
941
+ expect(content).toMatch(/Book Id\: Moby/);
942
+ expect(content).toMatch(/Chapter Id\: 1/);
943
+
944
+ element(by.partialLinkText('Scarlet')).click();
945
+
946
+ content = element(by.css('[ng-view]')).getText();
947
+ expect(content).toMatch(/controller\: BookCtrl/);
948
+ expect(content).toMatch(/Book Id\: Scarlet/);
949
+ });
950
+ </file>
951
+ </example>
952
+ */
953
+
954
+
955
+ /**
956
+ * @ngdoc event
957
+ * @name ngView#$viewContentLoaded
958
+ * @eventType emit on the current ngView scope
959
+ * @description
960
+ * Emitted every time the ngView content is reloaded.
961
+ */
962
+ ngViewFactory.$inject = ['$route', '$anchorScroll', '$animate'];
963
+ function ngViewFactory($route, $anchorScroll, $animate) {
964
+ return {
965
+ restrict: 'ECA',
966
+ terminal: true,
967
+ priority: 400,
968
+ transclude: 'element',
969
+ link: function(scope, $element, attr, ctrl, $transclude) {
970
+ var currentScope,
971
+ currentElement,
972
+ previousLeaveAnimation,
973
+ autoScrollExp = attr.autoscroll,
974
+ onloadExp = attr.onload || '';
975
+
976
+ scope.$on('$routeChangeSuccess', update);
977
+ update();
978
+
979
+ function cleanupLastView() {
980
+ if (previousLeaveAnimation) {
981
+ $animate.cancel(previousLeaveAnimation);
982
+ previousLeaveAnimation = null;
983
+ }
984
+
985
+ if (currentScope) {
986
+ currentScope.$destroy();
987
+ currentScope = null;
988
+ }
989
+ if (currentElement) {
990
+ previousLeaveAnimation = $animate.leave(currentElement);
991
+ previousLeaveAnimation.then(function() {
992
+ previousLeaveAnimation = null;
993
+ });
994
+ currentElement = null;
995
+ }
996
+ }
997
+
998
+ function update() {
999
+ var locals = $route.current && $route.current.locals,
1000
+ template = locals && locals.$template;
1001
+
1002
+ if (angular.isDefined(template)) {
1003
+ var newScope = scope.$new();
1004
+ var current = $route.current;
1005
+
1006
+ // Note: This will also link all children of ng-view that were contained in the original
1007
+ // html. If that content contains controllers, ... they could pollute/change the scope.
1008
+ // However, using ng-view on an element with additional content does not make sense...
1009
+ // Note: We can't remove them in the cloneAttchFn of $transclude as that
1010
+ // function is called before linking the content, which would apply child
1011
+ // directives to non existing elements.
1012
+ var clone = $transclude(newScope, function(clone) {
1013
+ $animate.enter(clone, null, currentElement || $element).then(function onNgViewEnter() {
1014
+ if (angular.isDefined(autoScrollExp)
1015
+ && (!autoScrollExp || scope.$eval(autoScrollExp))) {
1016
+ $anchorScroll();
1017
+ }
1018
+ });
1019
+ cleanupLastView();
1020
+ });
1021
+
1022
+ currentElement = clone;
1023
+ currentScope = current.scope = newScope;
1024
+ currentScope.$emit('$viewContentLoaded');
1025
+ currentScope.$eval(onloadExp);
1026
+ } else {
1027
+ cleanupLastView();
1028
+ }
1029
+ }
1030
+ }
1031
+ };
1032
+ }
1033
+
1034
+ // This directive is called during the $transclude call of the first `ngView` directive.
1035
+ // It will replace and compile the content of the element with the loaded template.
1036
+ // We need this directive so that the element content is already filled when
1037
+ // the link function of another directive on the same element as ngView
1038
+ // is called.
1039
+ ngViewFillContentFactory.$inject = ['$compile', '$controller', '$route'];
1040
+ function ngViewFillContentFactory($compile, $controller, $route) {
1041
+ return {
1042
+ restrict: 'ECA',
1043
+ priority: -400,
1044
+ link: function(scope, $element) {
1045
+ var current = $route.current,
1046
+ locals = current.locals;
1047
+
1048
+ $element.html(locals.$template);
1049
+
1050
+ var link = $compile($element.contents());
1051
+
1052
+ if (current.controller) {
1053
+ locals.$scope = scope;
1054
+ var controller = $controller(current.controller, locals);
1055
+ if (current.controllerAs) {
1056
+ scope[current.controllerAs] = controller;
1057
+ }
1058
+ $element.data('$ngControllerController', controller);
1059
+ $element.children().data('$ngControllerController', controller);
1060
+ }
1061
+ scope[current.resolveAs || '$resolve'] = locals;
1062
+
1063
+ link(scope);
1064
+ }
1065
+ };
1066
+ }
1067
+
1068
+
1069
+ })(window, window.angular);