@timshel_npm/maildev 3.2.17 → 3.2.19

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 (39) hide show
  1. package/README.md +2 -2
  2. package/dist/app/components/angular/angular.js +5537 -3622
  3. package/dist/app/components/angular/angular.min.js +213 -196
  4. package/dist/app/components/angular/angular.min.js.map +4 -4
  5. package/dist/app/components/angular-cookies/angular-cookies.js +183 -179
  6. package/dist/app/components/angular-cookies/angular-cookies.min.js +5 -5
  7. package/dist/app/components/angular-cookies/angular-cookies.min.js.map +7 -7
  8. package/dist/app/components/angular-resource/angular-resource.js +129 -48
  9. package/dist/app/components/angular-resource/angular-resource.min.js +8 -7
  10. package/dist/app/components/angular-resource/angular-resource.min.js.map +3 -3
  11. package/dist/app/components/angular-route/angular-route.js +246 -216
  12. package/dist/app/components/angular-route/angular-route.min.js +9 -9
  13. package/dist/app/components/angular-route/angular-route.min.js.map +2 -2
  14. package/dist/app/components/angular-sanitize/angular-sanitize.js +122 -90
  15. package/dist/app/components/angular-sanitize/angular-sanitize.min.js +10 -9
  16. package/dist/app/components/angular-sanitize/angular-sanitize.min.js.map +3 -3
  17. package/dist/app/components/socket.io/socket.io.min.js +3 -3
  18. package/dist/app/index.html +13 -14
  19. package/dist/app/styles/style.css +998 -37
  20. package/dist/app/views/item.html +64 -82
  21. package/dist/lib/mailserver.d.ts +1 -1
  22. package/dist/lib/mailserver.js +12 -11
  23. package/dist/lib/routes.js +2 -3
  24. package/package.json +15 -17
  25. package/dist/app/webfonts/fa-brands-400.eot +0 -0
  26. package/dist/app/webfonts/fa-brands-400.svg +0 -3717
  27. package/dist/app/webfonts/fa-brands-400.ttf +0 -0
  28. package/dist/app/webfonts/fa-brands-400.woff +0 -0
  29. package/dist/app/webfonts/fa-brands-400.woff2 +0 -0
  30. package/dist/app/webfonts/fa-regular-400.eot +0 -0
  31. package/dist/app/webfonts/fa-regular-400.svg +0 -801
  32. package/dist/app/webfonts/fa-regular-400.ttf +0 -0
  33. package/dist/app/webfonts/fa-regular-400.woff +0 -0
  34. package/dist/app/webfonts/fa-regular-400.woff2 +0 -0
  35. package/dist/app/webfonts/fa-solid-900.eot +0 -0
  36. package/dist/app/webfonts/fa-solid-900.svg +0 -5028
  37. package/dist/app/webfonts/fa-solid-900.ttf +0 -0
  38. package/dist/app/webfonts/fa-solid-900.woff +0 -0
  39. package/dist/app/webfonts/fa-solid-900.woff2 +0 -0
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @license AngularJS v1.2.3
2
+ * @license AngularJS v1.2.32
3
3
  * (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
6
6
  (function(window, angular, undefined) {'use strict';
7
7
 
8
8
  /**
9
- * @ngdoc overview
9
+ * @ngdoc module
10
10
  * @name ngRoute
11
11
  * @description
12
12
  *
@@ -16,8 +16,7 @@
16
16
  *
17
17
  * ## Example
18
18
  * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
19
- *
20
- * {@installModule route}
19
+ *
21
20
  *
22
21
  * <div doc-module-components="ngRoute"></div>
23
22
  */
@@ -26,14 +25,14 @@ var ngRouteModule = angular.module('ngRoute', ['ng']).
26
25
  provider('$route', $RouteProvider);
27
26
 
28
27
  /**
29
- * @ngdoc object
30
- * @name ngRoute.$routeProvider
31
- * @function
28
+ * @ngdoc provider
29
+ * @name $routeProvider
30
+ * @kind function
32
31
  *
33
32
  * @description
34
33
  *
35
34
  * Used for configuring routes.
36
- *
35
+ *
37
36
  * ## Example
38
37
  * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
39
38
  *
@@ -49,27 +48,26 @@ function $RouteProvider(){
49
48
 
50
49
  /**
51
50
  * @ngdoc method
52
- * @name ngRoute.$routeProvider#when
53
- * @methodOf ngRoute.$routeProvider
51
+ * @name $routeProvider#when
54
52
  *
55
53
  * @param {string} path Route path (matched against `$location.path`). If `$location.path`
56
54
  * contains redundant trailing slash or is missing one, the route will still match and the
57
55
  * `$location.path` will be updated to add or drop the trailing slash to exactly match the
58
56
  * route definition.
59
57
  *
60
- * * `path` can contain named groups starting with a colon (`:name`). All characters up
58
+ * * `path` can contain named groups starting with a colon: e.g. `:name`. All characters up
61
59
  * to the next slash are matched and stored in `$routeParams` under the given `name`
62
60
  * when the route matches.
63
- * * `path` can contain named groups starting with a colon and ending with a star (`:name*`).
64
- * All characters are eagerly stored in `$routeParams` under the given `name`
61
+ * * `path` can contain named groups starting with a colon and ending with a star:
62
+ * e.g.`:name*`. All characters are eagerly stored in `$routeParams` under the given `name`
65
63
  * when the route matches.
66
- * * `path` can contain optional named groups with a question mark (`:name?`).
64
+ * * `path` can contain optional named groups with a question mark: e.g.`:name?`.
67
65
  *
68
66
  * For example, routes like `/color/:color/largecode/:largecode*\/edit` will match
69
- * `/color/brown/largecode/code/with/slashs/edit` and extract:
67
+ * `/color/brown/largecode/code/with/slashes/edit` and extract:
70
68
  *
71
- * * `color: brown`
72
- * * `largecode: code/with/slashs`.
69
+ * * `color: brown`
70
+ * * `largecode: code/with/slashes`.
73
71
  *
74
72
  *
75
73
  * @param {Object} route Mapping information to be assigned to `$route.current` on route
@@ -112,7 +110,7 @@ function $RouteProvider(){
112
110
  *
113
111
  * - `key` – `{string}`: a name of a dependency to be injected into the controller.
114
112
  * - `factory` - `{string|function}`: If `string` then it is an alias for a service.
115
- * Otherwise if function, then it is {@link api/AUTO.$injector#invoke injected}
113
+ * Otherwise if function, then it is {@link auto.$injector#invoke injected}
116
114
  * and the return value is treated as the dependency. If the result is a promise, it is
117
115
  * resolved before its value is injected into the controller. Be aware that
118
116
  * `ngRoute.$routeParams` will still refer to the previous route within these resolve
@@ -190,7 +188,7 @@ function $RouteProvider(){
190
188
 
191
189
  path = path
192
190
  .replace(/([().])/g, '\\$1')
193
- .replace(/(\/)?:(\w+)([\?|\*])?/g, function(_, slash, key, option){
191
+ .replace(/(\/)?:(\w+)([\?\*])?/g, function(_, slash, key, option){
194
192
  var optional = option === '?' ? option : null;
195
193
  var star = option === '*' ? option : null;
196
194
  keys.push({ name: key, optional: !!optional });
@@ -212,8 +210,7 @@ function $RouteProvider(){
212
210
 
213
211
  /**
214
212
  * @ngdoc method
215
- * @name ngRoute.$routeProvider#otherwise
216
- * @methodOf ngRoute.$routeProvider
213
+ * @name $routeProvider#otherwise
217
214
  *
218
215
  * @description
219
216
  * Sets route definition that will be used on route change when no other route definition
@@ -239,8 +236,8 @@ function $RouteProvider(){
239
236
  function($rootScope, $location, $routeParams, $q, $injector, $http, $templateCache, $sce) {
240
237
 
241
238
  /**
242
- * @ngdoc object
243
- * @name ngRoute.$route
239
+ * @ngdoc service
240
+ * @name $route
244
241
  * @requires $location
245
242
  * @requires $routeParams
246
243
  *
@@ -255,7 +252,7 @@ function $RouteProvider(){
255
252
  * - `$scope` - The current route scope.
256
253
  * - `$template` - The current route template HTML.
257
254
  *
258
- * @property {Array.<Object>} routes Array of all configured routes.
255
+ * @property {Object} routes Object with all route configuration Objects as its properties.
259
256
  *
260
257
  * @description
261
258
  * `$route` is used for deep-linking URLs to controllers and views (HTML partials).
@@ -270,112 +267,112 @@ function $RouteProvider(){
270
267
  * {@link ngRoute.$routeParams `$routeParams`} service.
271
268
  *
272
269
  * @example
273
- This example shows how changing the URL hash causes the `$route` to match a route against the
274
- URL, and the `ngView` pulls in the partial.
275
-
276
- Note that this example is using {@link ng.directive:script inlined templates}
277
- to get it working on jsfiddle as well.
278
-
279
- <example module="ngViewExample" deps="angular-route.js">
280
- <file name="index.html">
281
- <div ng-controller="MainCntl">
282
- Choose:
283
- <a href="Book/Moby">Moby</a> |
284
- <a href="Book/Moby/ch/1">Moby: Ch1</a> |
285
- <a href="Book/Gatsby">Gatsby</a> |
286
- <a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
287
- <a href="Book/Scarlet">Scarlet Letter</a><br/>
288
-
289
- <div ng-view></div>
290
- <hr />
291
-
292
- <pre>$location.path() = {{$location.path()}}</pre>
293
- <pre>$route.current.templateUrl = {{$route.current.templateUrl}}</pre>
294
- <pre>$route.current.params = {{$route.current.params}}</pre>
295
- <pre>$route.current.scope.name = {{$route.current.scope.name}}</pre>
296
- <pre>$routeParams = {{$routeParams}}</pre>
297
- </div>
298
- </file>
299
-
300
- <file name="book.html">
301
- controller: {{name}}<br />
302
- Book Id: {{params.bookId}}<br />
303
- </file>
304
-
305
- <file name="chapter.html">
306
- controller: {{name}}<br />
307
- Book Id: {{params.bookId}}<br />
308
- Chapter Id: {{params.chapterId}}
309
- </file>
310
-
311
- <file name="script.js">
312
- angular.module('ngViewExample', ['ngRoute'])
313
-
314
- .config(function($routeProvider, $locationProvider) {
315
- $routeProvider.when('/Book/:bookId', {
316
- templateUrl: 'book.html',
317
- controller: BookCntl,
318
- resolve: {
319
- // I will cause a 1 second delay
320
- delay: function($q, $timeout) {
321
- var delay = $q.defer();
322
- $timeout(delay.resolve, 1000);
323
- return delay.promise;
324
- }
325
- }
326
- });
327
- $routeProvider.when('/Book/:bookId/ch/:chapterId', {
328
- templateUrl: 'chapter.html',
329
- controller: ChapterCntl
330
- });
331
-
332
- // configure html5 to get links working on jsfiddle
333
- $locationProvider.html5Mode(true);
334
- });
335
-
336
- function MainCntl($scope, $route, $routeParams, $location) {
337
- $scope.$route = $route;
338
- $scope.$location = $location;
339
- $scope.$routeParams = $routeParams;
340
- }
341
-
342
- function BookCntl($scope, $routeParams) {
343
- $scope.name = "BookCntl";
344
- $scope.params = $routeParams;
345
- }
346
-
347
- function ChapterCntl($scope, $routeParams) {
348
- $scope.name = "ChapterCntl";
349
- $scope.params = $routeParams;
350
- }
351
- </file>
352
-
353
- <file name="scenario.js">
354
- it('should load and compile correct template', function() {
355
- element('a:contains("Moby: Ch1")').click();
356
- var content = element('.doc-example-live [ng-view]').text();
357
- expect(content).toMatch(/controller\: ChapterCntl/);
358
- expect(content).toMatch(/Book Id\: Moby/);
359
- expect(content).toMatch(/Chapter Id\: 1/);
360
-
361
- element('a:contains("Scarlet")').click();
362
- sleep(2); // promises are not part of scenario waiting
363
- content = element('.doc-example-live [ng-view]').text();
364
- expect(content).toMatch(/controller\: BookCntl/);
365
- expect(content).toMatch(/Book Id\: Scarlet/);
366
- });
367
- </file>
368
- </example>
270
+ * This example shows how changing the URL hash causes the `$route` to match a route against the
271
+ * URL, and the `ngView` pulls in the partial.
272
+ *
273
+ * <example name="$route-service" module="ngRouteExample"
274
+ * deps="angular-route.js" fixBase="true">
275
+ * <file name="index.html">
276
+ * <div ng-controller="MainController">
277
+ * Choose:
278
+ * <a href="Book/Moby">Moby</a> |
279
+ * <a href="Book/Moby/ch/1">Moby: Ch1</a> |
280
+ * <a href="Book/Gatsby">Gatsby</a> |
281
+ * <a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
282
+ * <a href="Book/Scarlet">Scarlet Letter</a><br/>
283
+ *
284
+ * <div ng-view></div>
285
+ *
286
+ * <hr />
287
+ *
288
+ * <pre>$location.path() = {{$location.path()}}</pre>
289
+ * <pre>$route.current.templateUrl = {{$route.current.templateUrl}}</pre>
290
+ * <pre>$route.current.params = {{$route.current.params}}</pre>
291
+ * <pre>$route.current.scope.name = {{$route.current.scope.name}}</pre>
292
+ * <pre>$routeParams = {{$routeParams}}</pre>
293
+ * </div>
294
+ * </file>
295
+ *
296
+ * <file name="book.html">
297
+ * controller: {{name}}<br />
298
+ * Book Id: {{params.bookId}}<br />
299
+ * </file>
300
+ *
301
+ * <file name="chapter.html">
302
+ * controller: {{name}}<br />
303
+ * Book Id: {{params.bookId}}<br />
304
+ * Chapter Id: {{params.chapterId}}
305
+ * </file>
306
+ *
307
+ * <file name="script.js">
308
+ * angular.module('ngRouteExample', ['ngRoute'])
309
+ *
310
+ * .controller('MainController', function($scope, $route, $routeParams, $location) {
311
+ * $scope.$route = $route;
312
+ * $scope.$location = $location;
313
+ * $scope.$routeParams = $routeParams;
314
+ * })
315
+ *
316
+ * .controller('BookController', function($scope, $routeParams) {
317
+ * $scope.name = "BookController";
318
+ * $scope.params = $routeParams;
319
+ * })
320
+ *
321
+ * .controller('ChapterController', function($scope, $routeParams) {
322
+ * $scope.name = "ChapterController";
323
+ * $scope.params = $routeParams;
324
+ * })
325
+ *
326
+ * .config(function($routeProvider, $locationProvider) {
327
+ * $routeProvider
328
+ * .when('/Book/:bookId', {
329
+ * templateUrl: 'book.html',
330
+ * controller: 'BookController',
331
+ * resolve: {
332
+ * // I will cause a 1 second delay
333
+ * delay: function($q, $timeout) {
334
+ * var delay = $q.defer();
335
+ * $timeout(delay.resolve, 1000);
336
+ * return delay.promise;
337
+ * }
338
+ * }
339
+ * })
340
+ * .when('/Book/:bookId/ch/:chapterId', {
341
+ * templateUrl: 'chapter.html',
342
+ * controller: 'ChapterController'
343
+ * });
344
+ *
345
+ * // configure html5 to get links working on jsfiddle
346
+ * $locationProvider.html5Mode(true);
347
+ * });
348
+ *
349
+ * </file>
350
+ *
351
+ * <file name="protractor.js" type="protractor">
352
+ * it('should load and compile correct template', function() {
353
+ * element(by.linkText('Moby: Ch1')).click();
354
+ * var content = element(by.css('[ng-view]')).getText();
355
+ * expect(content).toMatch(/controller\: ChapterController/);
356
+ * expect(content).toMatch(/Book Id\: Moby/);
357
+ * expect(content).toMatch(/Chapter Id\: 1/);
358
+ *
359
+ * element(by.partialLinkText('Scarlet')).click();
360
+ *
361
+ * content = element(by.css('[ng-view]')).getText();
362
+ * expect(content).toMatch(/controller\: BookController/);
363
+ * expect(content).toMatch(/Book Id\: Scarlet/);
364
+ * });
365
+ * </file>
366
+ * </example>
369
367
  */
370
368
 
371
369
  /**
372
370
  * @ngdoc event
373
- * @name ngRoute.$route#$routeChangeStart
374
- * @eventOf ngRoute.$route
371
+ * @name $route#$routeChangeStart
375
372
  * @eventType broadcast on root scope
376
373
  * @description
377
374
  * Broadcasted before a route change. At this point the route services starts
378
- * resolving all of the dependencies needed for the route change to occurs.
375
+ * resolving all of the dependencies needed for the route change to occur.
379
376
  * Typically this involves fetching the view template as well as any dependencies
380
377
  * defined in `resolve` route property. Once all of the dependencies are resolved
381
378
  * `$routeChangeSuccess` is fired.
@@ -387,8 +384,7 @@ function $RouteProvider(){
387
384
 
388
385
  /**
389
386
  * @ngdoc event
390
- * @name ngRoute.$route#$routeChangeSuccess
391
- * @eventOf ngRoute.$route
387
+ * @name $route#$routeChangeSuccess
392
388
  * @eventType broadcast on root scope
393
389
  * @description
394
390
  * Broadcasted after a route dependencies are resolved.
@@ -403,8 +399,7 @@ function $RouteProvider(){
403
399
 
404
400
  /**
405
401
  * @ngdoc event
406
- * @name ngRoute.$route#$routeChangeError
407
- * @eventOf ngRoute.$route
402
+ * @name $route#$routeChangeError
408
403
  * @eventType broadcast on root scope
409
404
  * @description
410
405
  * Broadcasted if any of the resolve promises are rejected.
@@ -417,8 +412,7 @@ function $RouteProvider(){
417
412
 
418
413
  /**
419
414
  * @ngdoc event
420
- * @name ngRoute.$route#$routeUpdate
421
- * @eventOf ngRoute.$route
415
+ * @name $route#$routeUpdate
422
416
  * @eventType broadcast on root scope
423
417
  * @description
424
418
  *
@@ -432,8 +426,7 @@ function $RouteProvider(){
432
426
 
433
427
  /**
434
428
  * @ngdoc method
435
- * @name ngRoute.$route#reload
436
- * @methodOf ngRoute.$route
429
+ * @name $route#reload
437
430
  *
438
431
  * @description
439
432
  * Causes `$route` service to reload the current route even if
@@ -477,9 +470,7 @@ function $RouteProvider(){
477
470
  for (var i = 1, len = m.length; i < len; ++i) {
478
471
  var key = keys[i - 1];
479
472
 
480
- var val = 'string' == typeof m[i]
481
- ? decodeURIComponent(m[i])
482
- : m[i];
473
+ var val = m[i];
483
474
 
484
475
  if (key && val) {
485
476
  params[key.name] = val;
@@ -565,7 +556,7 @@ function $RouteProvider(){
565
556
 
566
557
 
567
558
  /**
568
- * @returns the current active route, by matching it against the URL
559
+ * @returns {Object} the current active route, by matching it against the URL
569
560
  */
570
561
  function parseRoute() {
571
562
  // Match a route
@@ -583,7 +574,7 @@ function $RouteProvider(){
583
574
  }
584
575
 
585
576
  /**
586
- * @returns interpolation of the redirect path with the parameters
577
+ * @returns {string} interpolation of the redirect path with the parameters
587
578
  */
588
579
  function interpolate(string, params) {
589
580
  var result = [];
@@ -591,7 +582,7 @@ function $RouteProvider(){
591
582
  if (i === 0) {
592
583
  result.push(segment);
593
584
  } else {
594
- var segmentMatch = segment.match(/(\w+)(.*)/);
585
+ var segmentMatch = segment.match(/(\w+)(?:[?*])?(.*)/);
595
586
  var key = segmentMatch[1];
596
587
  result.push(params[key]);
597
588
  result.push(segmentMatch[2] || '');
@@ -607,8 +598,8 @@ ngRouteModule.provider('$routeParams', $RouteParamsProvider);
607
598
 
608
599
 
609
600
  /**
610
- * @ngdoc object
611
- * @name ngRoute.$routeParams
601
+ * @ngdoc service
602
+ * @name $routeParams
612
603
  * @requires $route
613
604
  *
614
605
  * @description
@@ -617,7 +608,7 @@ ngRouteModule.provider('$routeParams', $RouteParamsProvider);
617
608
  * Requires the {@link ngRoute `ngRoute`} module to be installed.
618
609
  *
619
610
  * The route parameters are a combination of {@link ng.$location `$location`}'s
620
- * {@link ng.$location#methods_search `search()`} and {@link ng.$location#methods_path `path()`}.
611
+ * {@link ng.$location#search `search()`} and {@link ng.$location#path `path()`}.
621
612
  * The `path` parameters are extracted when the {@link ngRoute.$route `$route`} path is matched.
622
613
  *
623
614
  * In case of parameter name collision, `path` params take precedence over `search` params.
@@ -630,24 +621,26 @@ ngRouteModule.provider('$routeParams', $RouteParamsProvider);
630
621
  * Instead you can use `$route.current.params` to access the new route's parameters.
631
622
  *
632
623
  * @example
633
- * <pre>
624
+ * ```js
634
625
  * // Given:
635
626
  * // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
636
627
  * // Route: /Chapter/:chapterId/Section/:sectionId
637
628
  * //
638
629
  * // Then
639
- * $routeParams ==> {chapterId:1, sectionId:2, search:'moby'}
640
- * </pre>
630
+ * $routeParams ==> {chapterId:'1', sectionId:'2', search:'moby'}
631
+ * ```
641
632
  */
642
633
  function $RouteParamsProvider() {
643
634
  this.$get = function() { return {}; };
644
635
  }
645
636
 
646
637
  ngRouteModule.directive('ngView', ngViewFactory);
638
+ ngRouteModule.directive('ngView', ngViewFillContentFactory);
639
+
647
640
 
648
641
  /**
649
642
  * @ngdoc directive
650
- * @name ngRoute.directive:ngView
643
+ * @name ngView
651
644
  * @restrict ECA
652
645
  *
653
646
  * @description
@@ -667,10 +660,21 @@ ngRouteModule.directive('ngView', ngViewFactory);
667
660
  *
668
661
  * @scope
669
662
  * @priority 400
663
+ * @param {string=} onload Expression to evaluate whenever the view updates.
664
+ *
665
+ * @param {string=} autoscroll Whether `ngView` should call {@link ng.$anchorScroll
666
+ * $anchorScroll} to scroll the viewport after the view is updated.
667
+ *
668
+ * - If the attribute is not set, disable scrolling.
669
+ * - If the attribute is set without value, enable scrolling.
670
+ * - Otherwise enable scrolling only if the `autoscroll` attribute value evaluated
671
+ * as an expression yields a truthy value.
670
672
  * @example
671
- <example module="ngViewExample" deps="angular-route.js" animations="true">
673
+ <example name="ngView-directive" module="ngViewExample"
674
+ deps="angular-route.js;angular-animate.js"
675
+ animations="true" fixBase="true">
672
676
  <file name="index.html">
673
- <div ng-controller="MainCntl as main">
677
+ <div ng-controller="MainCtrl as main">
674
678
  Choose:
675
679
  <a href="Book/Moby">Moby</a> |
676
680
  <a href="Book/Moby/ch/1">Moby: Ch1</a> |
@@ -749,51 +753,52 @@ ngRouteModule.directive('ngView', ngViewFactory);
749
753
  </file>
750
754
 
751
755
  <file name="script.js">
752
- angular.module('ngViewExample', ['ngRoute', 'ngAnimate'],
753
- function($routeProvider, $locationProvider) {
754
- $routeProvider.when('/Book/:bookId', {
755
- templateUrl: 'book.html',
756
- controller: BookCntl,
757
- controllerAs: 'book'
758
- });
759
- $routeProvider.when('/Book/:bookId/ch/:chapterId', {
760
- templateUrl: 'chapter.html',
761
- controller: ChapterCntl,
762
- controllerAs: 'chapter'
763
- });
764
-
765
- // configure html5 to get links working on jsfiddle
766
- $locationProvider.html5Mode(true);
767
- });
768
-
769
- function MainCntl($route, $routeParams, $location) {
770
- this.$route = $route;
771
- this.$location = $location;
772
- this.$routeParams = $routeParams;
773
- }
774
-
775
- function BookCntl($routeParams) {
776
- this.name = "BookCntl";
777
- this.params = $routeParams;
778
- }
756
+ angular.module('ngViewExample', ['ngRoute', 'ngAnimate'])
757
+ .config(['$routeProvider', '$locationProvider',
758
+ function($routeProvider, $locationProvider) {
759
+ $routeProvider
760
+ .when('/Book/:bookId', {
761
+ templateUrl: 'book.html',
762
+ controller: 'BookCtrl',
763
+ controllerAs: 'book'
764
+ })
765
+ .when('/Book/:bookId/ch/:chapterId', {
766
+ templateUrl: 'chapter.html',
767
+ controller: 'ChapterCtrl',
768
+ controllerAs: 'chapter'
769
+ });
770
+
771
+ $locationProvider.html5Mode(true);
772
+ }])
773
+ .controller('MainCtrl', ['$route', '$routeParams', '$location',
774
+ function($route, $routeParams, $location) {
775
+ this.$route = $route;
776
+ this.$location = $location;
777
+ this.$routeParams = $routeParams;
778
+ }])
779
+ .controller('BookCtrl', ['$routeParams', function($routeParams) {
780
+ this.name = "BookCtrl";
781
+ this.params = $routeParams;
782
+ }])
783
+ .controller('ChapterCtrl', ['$routeParams', function($routeParams) {
784
+ this.name = "ChapterCtrl";
785
+ this.params = $routeParams;
786
+ }]);
779
787
 
780
- function ChapterCntl($routeParams) {
781
- this.name = "ChapterCntl";
782
- this.params = $routeParams;
783
- }
784
788
  </file>
785
789
 
786
- <file name="scenario.js">
790
+ <file name="protractor.js" type="protractor">
787
791
  it('should load and compile correct template', function() {
788
- element('a:contains("Moby: Ch1")').click();
789
- var content = element('.doc-example-live [ng-view]').text();
790
- expect(content).toMatch(/controller\: ChapterCntl/);
792
+ element(by.linkText('Moby: Ch1')).click();
793
+ var content = element(by.css('[ng-view]')).getText();
794
+ expect(content).toMatch(/controller\: ChapterCtrl/);
791
795
  expect(content).toMatch(/Book Id\: Moby/);
792
796
  expect(content).toMatch(/Chapter Id\: 1/);
793
797
 
794
- element('a:contains("Scarlet")').click();
795
- content = element('.doc-example-live [ng-view]').text();
796
- expect(content).toMatch(/controller\: BookCntl/);
798
+ element(by.partialLinkText('Scarlet')).click();
799
+
800
+ content = element(by.css('[ng-view]')).getText();
801
+ expect(content).toMatch(/controller\: BookCtrl/);
797
802
  expect(content).toMatch(/Book Id\: Scarlet/);
798
803
  });
799
804
  </file>
@@ -803,14 +808,13 @@ ngRouteModule.directive('ngView', ngViewFactory);
803
808
 
804
809
  /**
805
810
  * @ngdoc event
806
- * @name ngRoute.directive:ngView#$viewContentLoaded
807
- * @eventOf ngRoute.directive:ngView
811
+ * @name ngView#$viewContentLoaded
808
812
  * @eventType emit on the current ngView scope
809
813
  * @description
810
814
  * Emitted every time the ngView content is reloaded.
811
815
  */
812
- ngViewFactory.$inject = ['$route', '$anchorScroll', '$compile', '$controller', '$animate'];
813
- function ngViewFactory( $route, $anchorScroll, $compile, $controller, $animate) {
816
+ ngViewFactory.$inject = ['$route', '$anchorScroll', '$animate'];
817
+ function ngViewFactory( $route, $anchorScroll, $animate) {
814
818
  return {
815
819
  restrict: 'ECA',
816
820
  terminal: true,
@@ -819,6 +823,7 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller,
819
823
  link: function(scope, $element, attr, ctrl, $transclude) {
820
824
  var currentScope,
821
825
  currentElement,
826
+ previousElement,
822
827
  autoScrollExp = attr.autoscroll,
823
828
  onloadExp = attr.onload || '';
824
829
 
@@ -826,12 +831,19 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller,
826
831
  update();
827
832
 
828
833
  function cleanupLastView() {
829
- if (currentScope) {
834
+ if(previousElement) {
835
+ previousElement.remove();
836
+ previousElement = null;
837
+ }
838
+ if(currentScope) {
830
839
  currentScope.$destroy();
831
840
  currentScope = null;
832
841
  }
833
842
  if(currentElement) {
834
- $animate.leave(currentElement);
843
+ $animate.leave(currentElement, function() {
844
+ previousElement = null;
845
+ });
846
+ previousElement = currentElement;
835
847
  currentElement = null;
836
848
  }
837
849
  }
@@ -840,8 +852,9 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller,
840
852
  var locals = $route.current && $route.current.locals,
841
853
  template = locals && locals.$template;
842
854
 
843
- if (template) {
855
+ if (angular.isDefined(template)) {
844
856
  var newScope = scope.$new();
857
+ var current = $route.current;
845
858
 
846
859
  // Note: This will also link all children of ng-view that were contained in the original
847
860
  // html. If that content contains controllers, ... they could pollute/change the scope.
@@ -849,34 +862,18 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller,
849
862
  // Note: We can't remove them in the cloneAttchFn of $transclude as that
850
863
  // function is called before linking the content, which would apply child
851
864
  // directives to non existing elements.
852
- var clone = $transclude(newScope, angular.noop);
853
- clone.html(template);
854
- $animate.enter(clone, null, currentElement || $element, function onNgViewEnter () {
855
- if (angular.isDefined(autoScrollExp)
856
- && (!autoScrollExp || scope.$eval(autoScrollExp))) {
857
- $anchorScroll();
858
- }
865
+ var clone = $transclude(newScope, function(clone) {
866
+ $animate.enter(clone, null, currentElement || $element, function onNgViewEnter () {
867
+ if (angular.isDefined(autoScrollExp)
868
+ && (!autoScrollExp || scope.$eval(autoScrollExp))) {
869
+ $anchorScroll();
870
+ }
871
+ });
872
+ cleanupLastView();
859
873
  });
860
874
 
861
- cleanupLastView();
862
-
863
- var link = $compile(clone.contents()),
864
- current = $route.current;
865
-
866
- currentScope = current.scope = newScope;
867
875
  currentElement = clone;
868
-
869
- if (current.controller) {
870
- locals.$scope = currentScope;
871
- var controller = $controller(current.controller, locals);
872
- if (current.controllerAs) {
873
- currentScope[current.controllerAs] = controller;
874
- }
875
- clone.data('$ngControllerController', controller);
876
- clone.children().data('$ngControllerController', controller);
877
- }
878
-
879
- link(currentScope);
876
+ currentScope = current.scope = newScope;
880
877
  currentScope.$emit('$viewContentLoaded');
881
878
  currentScope.$eval(onloadExp);
882
879
  } else {
@@ -887,5 +884,38 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller,
887
884
  };
888
885
  }
889
886
 
887
+ // This directive is called during the $transclude call of the first `ngView` directive.
888
+ // It will replace and compile the content of the element with the loaded template.
889
+ // We need this directive so that the element content is already filled when
890
+ // the link function of another directive on the same element as ngView
891
+ // is called.
892
+ ngViewFillContentFactory.$inject = ['$compile', '$controller', '$route'];
893
+ function ngViewFillContentFactory($compile, $controller, $route) {
894
+ return {
895
+ restrict: 'ECA',
896
+ priority: -400,
897
+ link: function(scope, $element) {
898
+ var current = $route.current,
899
+ locals = current.locals;
900
+
901
+ $element.html(locals.$template);
902
+
903
+ var link = $compile($element.contents());
904
+
905
+ if (current.controller) {
906
+ locals.$scope = scope;
907
+ var controller = $controller(current.controller, locals);
908
+ if (current.controllerAs) {
909
+ scope[current.controllerAs] = controller;
910
+ }
911
+ $element.data('$ngControllerController', controller);
912
+ $element.children().data('$ngControllerController', controller);
913
+ }
914
+
915
+ link(scope);
916
+ }
917
+ };
918
+ }
919
+
890
920
 
891
921
  })(window, window.angular);