angularjs-rails 1.2.13 → 1.2.14
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.
- checksums.yaml +4 -4
- data/lib/angularjs-rails/version.rb +1 -1
- data/vendor/assets/javascripts/angular-animate.js +286 -261
- data/vendor/assets/javascripts/angular-cookies.js +14 -19
- data/vendor/assets/javascripts/angular-loader.js +33 -29
- data/vendor/assets/javascripts/angular-mocks.js +163 -139
- data/vendor/assets/javascripts/angular-resource.js +34 -33
- data/vendor/assets/javascripts/angular-route.js +55 -54
- data/vendor/assets/javascripts/angular-sanitize.js +17 -18
- data/vendor/assets/javascripts/angular-scenario.js +1647 -1468
- data/vendor/assets/javascripts/angular-touch.js +21 -23
- data/vendor/assets/javascripts/angular.js +1646 -1467
- metadata +2 -2
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.14
|
3
3
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -49,7 +49,7 @@ function shallowClearAndCopy(src, dst) {
|
|
49
49
|
}
|
50
50
|
|
51
51
|
/**
|
52
|
-
* @ngdoc
|
52
|
+
* @ngdoc module
|
53
53
|
* @name ngResource
|
54
54
|
* @description
|
55
55
|
*
|
@@ -58,7 +58,6 @@ function shallowClearAndCopy(src, dst) {
|
|
58
58
|
* The `ngResource` module provides interaction support with RESTful services
|
59
59
|
* via the $resource service.
|
60
60
|
*
|
61
|
-
* {@installModule resource}
|
62
61
|
*
|
63
62
|
* <div doc-module-components="ngResource"></div>
|
64
63
|
*
|
@@ -66,8 +65,8 @@ function shallowClearAndCopy(src, dst) {
|
|
66
65
|
*/
|
67
66
|
|
68
67
|
/**
|
69
|
-
* @ngdoc
|
70
|
-
* @name
|
68
|
+
* @ngdoc service
|
69
|
+
* @name $resource
|
71
70
|
* @requires $http
|
72
71
|
*
|
73
72
|
* @description
|
@@ -103,8 +102,8 @@ function shallowClearAndCopy(src, dst) {
|
|
103
102
|
* If the parameter value is prefixed with `@` then the value of that parameter is extracted from
|
104
103
|
* the data object (useful for non-GET operations).
|
105
104
|
*
|
106
|
-
* @param {Object
|
107
|
-
* default set of resource actions. The declaration should be created in the format of {@link
|
105
|
+
* @param {Object.<Object>=} actions Hash with declaration of custom action that should extend
|
106
|
+
* the default set of resource actions. The declaration should be created in the format of {@link
|
108
107
|
* ng.$http#usage_parameters $http.config}:
|
109
108
|
*
|
110
109
|
* {action1: {method:?, params:?, isArray:?, headers:?, ...},
|
@@ -139,35 +138,37 @@ function shallowClearAndCopy(src, dst) {
|
|
139
138
|
* - **`timeout`** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise} that
|
140
139
|
* should abort the request when resolved.
|
141
140
|
* - **`withCredentials`** - `{boolean}` - whether to set the `withCredentials` flag on the
|
142
|
-
* XHR object. See
|
143
|
-
* requests with credentials
|
144
|
-
*
|
145
|
-
*
|
141
|
+
* XHR object. See
|
142
|
+
* [requests with credentials](https://developer.mozilla.org/en/http_access_control#section_5)
|
143
|
+
* for more information.
|
144
|
+
* - **`responseType`** - `{string}` - see
|
145
|
+
* [requestType](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType).
|
146
146
|
* - **`interceptor`** - `{Object=}` - The interceptor object has two optional methods -
|
147
147
|
* `response` and `responseError`. Both `response` and `responseError` interceptors get called
|
148
148
|
* with `http response` object. See {@link ng.$http $http interceptors}.
|
149
149
|
*
|
150
150
|
* @returns {Object} A resource "class" object with methods for the default set of resource actions
|
151
151
|
* optionally extended with custom `actions`. The default set contains these actions:
|
152
|
-
*
|
153
|
-
*
|
154
|
-
*
|
155
|
-
*
|
156
|
-
*
|
157
|
-
*
|
152
|
+
* ```js
|
153
|
+
* { 'get': {method:'GET'},
|
154
|
+
* 'save': {method:'POST'},
|
155
|
+
* 'query': {method:'GET', isArray:true},
|
156
|
+
* 'remove': {method:'DELETE'},
|
157
|
+
* 'delete': {method:'DELETE'} };
|
158
|
+
* ```
|
158
159
|
*
|
159
160
|
* Calling these methods invoke an {@link ng.$http} with the specified http method,
|
160
161
|
* destination and parameters. When the data is returned from the server then the object is an
|
161
162
|
* instance of the resource class. The actions `save`, `remove` and `delete` are available on it
|
162
163
|
* as methods with the `$` prefix. This allows you to easily perform CRUD operations (create,
|
163
164
|
* read, update, delete) on server-side data like this:
|
164
|
-
*
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
165
|
+
* ```js
|
166
|
+
* var User = $resource('/user/:userId', {userId:'@id'});
|
167
|
+
* var user = User.get({userId:123}, function() {
|
168
|
+
* user.abc = true;
|
169
|
+
* user.$save();
|
170
|
+
* });
|
171
|
+
* ```
|
171
172
|
*
|
172
173
|
* It is important to realize that invoking a $resource object method immediately returns an
|
173
174
|
* empty reference (object or array depending on `isArray`). Once the data is returned from the
|
@@ -211,7 +212,7 @@ function shallowClearAndCopy(src, dst) {
|
|
211
212
|
*
|
212
213
|
* # Credit card resource
|
213
214
|
*
|
214
|
-
*
|
215
|
+
* ```js
|
215
216
|
// Define CreditCard class
|
216
217
|
var CreditCard = $resource('/user/:userId/card/:cardId',
|
217
218
|
{userId:123, cardId:'@id'}, {
|
@@ -244,7 +245,7 @@ function shallowClearAndCopy(src, dst) {
|
|
244
245
|
// POST: /user/123/card {number:'0123', name:'Mike Smith'}
|
245
246
|
// server returns: {id:789, number:'0123', name: 'Mike Smith'};
|
246
247
|
expect(newCard.id).toEqual(789);
|
247
|
-
*
|
248
|
+
* ```
|
248
249
|
*
|
249
250
|
* The object returned from this function execution is a resource "class" which has "static" method
|
250
251
|
* for each action in the definition.
|
@@ -255,19 +256,19 @@ function shallowClearAndCopy(src, dst) {
|
|
255
256
|
* all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD
|
256
257
|
* operations (create, read, update, delete) on server-side data.
|
257
258
|
|
258
|
-
|
259
|
+
```js
|
259
260
|
var User = $resource('/user/:userId', {userId:'@id'});
|
260
261
|
var user = User.get({userId:123}, function() {
|
261
262
|
user.abc = true;
|
262
263
|
user.$save();
|
263
264
|
});
|
264
|
-
|
265
|
+
```
|
265
266
|
*
|
266
267
|
* It's worth noting that the success callback for `get`, `query` and other methods gets passed
|
267
268
|
* in the response that came from the server as well as $http header getter function, so one
|
268
269
|
* could rewrite the above example and get access to http headers as:
|
269
270
|
*
|
270
|
-
|
271
|
+
```js
|
271
272
|
var User = $resource('/user/:userId', {userId:'@id'});
|
272
273
|
User.get({userId:123}, function(u, getResponseHeaders){
|
273
274
|
u.abc = true;
|
@@ -276,15 +277,15 @@ function shallowClearAndCopy(src, dst) {
|
|
276
277
|
//putResponseHeaders => $http header getter
|
277
278
|
});
|
278
279
|
});
|
279
|
-
|
280
|
+
```
|
280
281
|
|
281
282
|
* # Creating a custom 'PUT' request
|
282
283
|
* In this example we create a custom method on our resource to make a PUT request
|
283
|
-
*
|
284
|
+
* ```js
|
284
285
|
* var app = angular.module('app', ['ngResource', 'ngRoute']);
|
285
286
|
*
|
286
287
|
* // Some APIs expect a PUT request in the format URL/object/ID
|
287
|
-
* // Here we are creating an 'update' method
|
288
|
+
* // Here we are creating an 'update' method
|
288
289
|
* app.factory('Notes', ['$resource', function($resource) {
|
289
290
|
* return $resource('/notes/:id', null,
|
290
291
|
* {
|
@@ -305,7 +306,7 @@ function shallowClearAndCopy(src, dst) {
|
|
305
306
|
*
|
306
307
|
* // This will PUT /notes/ID with the note object in the request payload
|
307
308
|
* }]);
|
308
|
-
*
|
309
|
+
* ```
|
309
310
|
*/
|
310
311
|
angular.module('ngResource', ['ng']).
|
311
312
|
factory('$resource', ['$http', '$q', function($http, $q) {
|
@@ -1,12 +1,12 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.14
|
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
|
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
|
30
|
-
* @name
|
28
|
+
* @ngdoc provider
|
29
|
+
* @name $routeProvider
|
31
30
|
* @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
|
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
|
-
*
|
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
|
-
*
|
61
|
+
* * `path` can contain named groups starting with a colon and ending with a star:
|
64
62
|
* e.g.`:name*`. All characters are eagerly stored in `$routeParams` under the given `name`
|
65
63
|
* when the route matches.
|
66
|
-
*
|
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/
|
67
|
+
* `/color/brown/largecode/code/with/slashes/edit` and extract:
|
70
68
|
*
|
71
|
-
*
|
72
|
-
*
|
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
|
@@ -89,7 +87,7 @@ function $RouteProvider(){
|
|
89
87
|
*
|
90
88
|
* If `template` is a function, it will be called with the following parameters:
|
91
89
|
*
|
92
|
-
* - `{Array
|
90
|
+
* - `{Array.<Object>}` - route parameters extracted from the current
|
93
91
|
* `$location.path()` by applying the current route
|
94
92
|
*
|
95
93
|
* - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html
|
@@ -97,7 +95,7 @@ function $RouteProvider(){
|
|
97
95
|
*
|
98
96
|
* If `templateUrl` is a function, it will be called with the following parameters:
|
99
97
|
*
|
100
|
-
* - `{Array
|
98
|
+
* - `{Array.<Object>}` - route parameters extracted from the current
|
101
99
|
* `$location.path()` by applying the current route
|
102
100
|
*
|
103
101
|
* - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should
|
@@ -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
|
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
|
@@ -212,8 +210,7 @@ function $RouteProvider(){
|
|
212
210
|
|
213
211
|
/**
|
214
212
|
* @ngdoc method
|
215
|
-
* @name
|
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
|
243
|
-
* @name
|
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
|
255
|
+
* @property {Array.<Object>} routes Array of all configured routes.
|
259
256
|
*
|
260
257
|
* @description
|
261
258
|
* `$route` is used for deep-linking URLs to controllers and views (HTML partials).
|
@@ -276,7 +273,7 @@ function $RouteProvider(){
|
|
276
273
|
Note that this example is using {@link ng.directive:script inlined templates}
|
277
274
|
to get it working on jsfiddle as well.
|
278
275
|
|
279
|
-
<example module="
|
276
|
+
<example name="$route-service" module="ngRouteExample" deps="angular-route.js" fixBase="true">
|
280
277
|
<file name="index.html">
|
281
278
|
<div ng-controller="MainCntl">
|
282
279
|
Choose:
|
@@ -309,7 +306,7 @@ function $RouteProvider(){
|
|
309
306
|
</file>
|
310
307
|
|
311
308
|
<file name="script.js">
|
312
|
-
angular.module('
|
309
|
+
angular.module('ngRouteExample', ['ngRoute'])
|
313
310
|
|
314
311
|
.config(function($routeProvider, $locationProvider) {
|
315
312
|
$routeProvider.when('/Book/:bookId', {
|
@@ -350,17 +347,17 @@ function $RouteProvider(){
|
|
350
347
|
}
|
351
348
|
</file>
|
352
349
|
|
353
|
-
<file name="
|
350
|
+
<file name="protractor.js" type="protractor">
|
354
351
|
it('should load and compile correct template', function() {
|
355
352
|
element(by.linkText('Moby: Ch1')).click();
|
356
|
-
var content = element(by.css('
|
353
|
+
var content = element(by.css('[ng-view]')).getText();
|
357
354
|
expect(content).toMatch(/controller\: ChapterCntl/);
|
358
355
|
expect(content).toMatch(/Book Id\: Moby/);
|
359
356
|
expect(content).toMatch(/Chapter Id\: 1/);
|
360
357
|
|
361
358
|
element(by.partialLinkText('Scarlet')).click();
|
362
359
|
|
363
|
-
content = element(by.css('
|
360
|
+
content = element(by.css('[ng-view]')).getText();
|
364
361
|
expect(content).toMatch(/controller\: BookCntl/);
|
365
362
|
expect(content).toMatch(/Book Id\: Scarlet/);
|
366
363
|
});
|
@@ -370,8 +367,7 @@ function $RouteProvider(){
|
|
370
367
|
|
371
368
|
/**
|
372
369
|
* @ngdoc event
|
373
|
-
* @name
|
374
|
-
* @eventOf ngRoute.$route
|
370
|
+
* @name $route#$routeChangeStart
|
375
371
|
* @eventType broadcast on root scope
|
376
372
|
* @description
|
377
373
|
* Broadcasted before a route change. At this point the route services starts
|
@@ -387,8 +383,7 @@ function $RouteProvider(){
|
|
387
383
|
|
388
384
|
/**
|
389
385
|
* @ngdoc event
|
390
|
-
* @name
|
391
|
-
* @eventOf ngRoute.$route
|
386
|
+
* @name $route#$routeChangeSuccess
|
392
387
|
* @eventType broadcast on root scope
|
393
388
|
* @description
|
394
389
|
* Broadcasted after a route dependencies are resolved.
|
@@ -403,8 +398,7 @@ function $RouteProvider(){
|
|
403
398
|
|
404
399
|
/**
|
405
400
|
* @ngdoc event
|
406
|
-
* @name
|
407
|
-
* @eventOf ngRoute.$route
|
401
|
+
* @name $route#$routeChangeError
|
408
402
|
* @eventType broadcast on root scope
|
409
403
|
* @description
|
410
404
|
* Broadcasted if any of the resolve promises are rejected.
|
@@ -417,8 +411,7 @@ function $RouteProvider(){
|
|
417
411
|
|
418
412
|
/**
|
419
413
|
* @ngdoc event
|
420
|
-
* @name
|
421
|
-
* @eventOf ngRoute.$route
|
414
|
+
* @name $route#$routeUpdate
|
422
415
|
* @eventType broadcast on root scope
|
423
416
|
* @description
|
424
417
|
*
|
@@ -432,8 +425,7 @@ function $RouteProvider(){
|
|
432
425
|
|
433
426
|
/**
|
434
427
|
* @ngdoc method
|
435
|
-
* @name
|
436
|
-
* @methodOf ngRoute.$route
|
428
|
+
* @name $route#reload
|
437
429
|
*
|
438
430
|
* @description
|
439
431
|
* Causes `$route` service to reload the current route even if
|
@@ -565,7 +557,7 @@ function $RouteProvider(){
|
|
565
557
|
|
566
558
|
|
567
559
|
/**
|
568
|
-
* @returns the current active route, by matching it against the URL
|
560
|
+
* @returns {Object} the current active route, by matching it against the URL
|
569
561
|
*/
|
570
562
|
function parseRoute() {
|
571
563
|
// Match a route
|
@@ -583,7 +575,7 @@ function $RouteProvider(){
|
|
583
575
|
}
|
584
576
|
|
585
577
|
/**
|
586
|
-
* @returns interpolation of the redirect path with the parameters
|
578
|
+
* @returns {string} interpolation of the redirect path with the parameters
|
587
579
|
*/
|
588
580
|
function interpolate(string, params) {
|
589
581
|
var result = [];
|
@@ -607,8 +599,8 @@ ngRouteModule.provider('$routeParams', $RouteParamsProvider);
|
|
607
599
|
|
608
600
|
|
609
601
|
/**
|
610
|
-
* @ngdoc
|
611
|
-
* @name
|
602
|
+
* @ngdoc service
|
603
|
+
* @name $routeParams
|
612
604
|
* @requires $route
|
613
605
|
*
|
614
606
|
* @description
|
@@ -617,7 +609,7 @@ ngRouteModule.provider('$routeParams', $RouteParamsProvider);
|
|
617
609
|
* Requires the {@link ngRoute `ngRoute`} module to be installed.
|
618
610
|
*
|
619
611
|
* The route parameters are a combination of {@link ng.$location `$location`}'s
|
620
|
-
* {@link ng.$location#
|
612
|
+
* {@link ng.$location#search `search()`} and {@link ng.$location#path `path()`}.
|
621
613
|
* The `path` parameters are extracted when the {@link ngRoute.$route `$route`} path is matched.
|
622
614
|
*
|
623
615
|
* In case of parameter name collision, `path` params take precedence over `search` params.
|
@@ -630,14 +622,14 @@ ngRouteModule.provider('$routeParams', $RouteParamsProvider);
|
|
630
622
|
* Instead you can use `$route.current.params` to access the new route's parameters.
|
631
623
|
*
|
632
624
|
* @example
|
633
|
-
*
|
625
|
+
* ```js
|
634
626
|
* // Given:
|
635
627
|
* // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
|
636
628
|
* // Route: /Chapter/:chapterId/Section/:sectionId
|
637
629
|
* //
|
638
630
|
* // Then
|
639
631
|
* $routeParams ==> {chapterId:1, sectionId:2, search:'moby'}
|
640
|
-
*
|
632
|
+
* ```
|
641
633
|
*/
|
642
634
|
function $RouteParamsProvider() {
|
643
635
|
this.$get = function() { return {}; };
|
@@ -649,7 +641,7 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
|
|
649
641
|
|
650
642
|
/**
|
651
643
|
* @ngdoc directive
|
652
|
-
* @name
|
644
|
+
* @name ngView
|
653
645
|
* @restrict ECA
|
654
646
|
*
|
655
647
|
* @description
|
@@ -679,7 +671,9 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
|
|
679
671
|
* - Otherwise enable scrolling only if the `autoscroll` attribute value evaluated
|
680
672
|
* as an expression yields a truthy value.
|
681
673
|
* @example
|
682
|
-
<example
|
674
|
+
<example name="ngView-directive" module="ngViewExample"
|
675
|
+
deps="angular-route.js;angular-animate.js"
|
676
|
+
animations="true" fixBase="true">
|
683
677
|
<file name="index.html">
|
684
678
|
<div ng-controller="MainCntl as main">
|
685
679
|
Choose:
|
@@ -794,17 +788,17 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
|
|
794
788
|
}
|
795
789
|
</file>
|
796
790
|
|
797
|
-
<file name="
|
791
|
+
<file name="protractor.js" type="protractor">
|
798
792
|
it('should load and compile correct template', function() {
|
799
793
|
element(by.linkText('Moby: Ch1')).click();
|
800
|
-
var content = element(by.css('
|
794
|
+
var content = element(by.css('[ng-view]')).getText();
|
801
795
|
expect(content).toMatch(/controller\: ChapterCntl/);
|
802
796
|
expect(content).toMatch(/Book Id\: Moby/);
|
803
797
|
expect(content).toMatch(/Chapter Id\: 1/);
|
804
798
|
|
805
799
|
element(by.partialLinkText('Scarlet')).click();
|
806
800
|
|
807
|
-
content = element(by.css('
|
801
|
+
content = element(by.css('[ng-view]')).getText();
|
808
802
|
expect(content).toMatch(/controller\: BookCntl/);
|
809
803
|
expect(content).toMatch(/Book Id\: Scarlet/);
|
810
804
|
});
|
@@ -815,8 +809,7 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
|
|
815
809
|
|
816
810
|
/**
|
817
811
|
* @ngdoc event
|
818
|
-
* @name
|
819
|
-
* @eventOf ngRoute.directive:ngView
|
812
|
+
* @name ngView#$viewContentLoaded
|
820
813
|
* @eventType emit on the current ngView scope
|
821
814
|
* @description
|
822
815
|
* Emitted every time the ngView content is reloaded.
|
@@ -831,6 +824,7 @@ function ngViewFactory( $route, $anchorScroll, $animate) {
|
|
831
824
|
link: function(scope, $element, attr, ctrl, $transclude) {
|
832
825
|
var currentScope,
|
833
826
|
currentElement,
|
827
|
+
previousElement,
|
834
828
|
autoScrollExp = attr.autoscroll,
|
835
829
|
onloadExp = attr.onload || '';
|
836
830
|
|
@@ -838,12 +832,19 @@ function ngViewFactory( $route, $anchorScroll, $animate) {
|
|
838
832
|
update();
|
839
833
|
|
840
834
|
function cleanupLastView() {
|
841
|
-
if
|
835
|
+
if(previousElement) {
|
836
|
+
previousElement.remove();
|
837
|
+
previousElement = null;
|
838
|
+
}
|
839
|
+
if(currentScope) {
|
842
840
|
currentScope.$destroy();
|
843
841
|
currentScope = null;
|
844
842
|
}
|
845
843
|
if(currentElement) {
|
846
|
-
$animate.leave(currentElement)
|
844
|
+
$animate.leave(currentElement, function() {
|
845
|
+
previousElement = null;
|
846
|
+
});
|
847
|
+
previousElement = currentElement;
|
847
848
|
currentElement = null;
|
848
849
|
}
|
849
850
|
}
|