angularjs-rails 1.2.14 → 1.2.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/angularjs-rails/version.rb +2 -2
- data/vendor/assets/javascripts/angular-animate.js +4 -5
- data/vendor/assets/javascripts/angular-cookies.js +8 -9
- data/vendor/assets/javascripts/angular-loader.js +6 -8
- data/vendor/assets/javascripts/angular-mocks.js +10 -11
- data/vendor/assets/javascripts/angular-resource.js +13 -3
- data/vendor/assets/javascripts/angular-route.js +139 -134
- data/vendor/assets/javascripts/angular-sanitize.js +2 -2
- data/vendor/assets/javascripts/angular-scenario.js +190 -81
- data/vendor/assets/javascripts/angular-touch.js +16 -2
- data/vendor/assets/javascripts/angular.js +196 -81
- data/vendor/assets/javascripts/unstable/angular-animate.js +1613 -0
- data/vendor/assets/javascripts/unstable/angular-cookies.js +40 -29
- data/vendor/assets/javascripts/unstable/angular-loader.js +166 -58
- data/vendor/assets/javascripts/unstable/angular-mocks.js +832 -535
- data/vendor/assets/javascripts/unstable/angular-resource.js +266 -196
- data/vendor/assets/javascripts/unstable/angular-route.js +927 -0
- data/vendor/assets/javascripts/unstable/angular-sanitize.js +246 -180
- data/vendor/assets/javascripts/unstable/angular-scenario.js +19167 -13895
- data/vendor/assets/javascripts/unstable/{angular-mobile.js → angular-touch.js} +241 -126
- data/vendor/assets/javascripts/unstable/angular.js +12891 -8032
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c607c5e86398be4c6e599a520c3a3cb830691731
|
4
|
+
data.tar.gz: 61bf58e1dbde57a1a0d34417c8a57eb4810073ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1237b0bd6a2250f58b9399ec55b24d60de19ce20fe024ca4eac250772aa7ff91893eaf3796554fb95ad5ee3d74024c9914e902887e2ae9e2657a9260e2ff0898
|
7
|
+
data.tar.gz: a5eceb843e09fbcd39b162b1571e4824b1c9704e7849b747d8fa3fb88706ced8c3ef3db86f6a8513a2d7ec661df37c292be0d4203781a0bd576c57fd9f2092d8
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.15
|
3
3
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -707,8 +707,7 @@ angular.module('ngAnimate', ['ng'])
|
|
707
707
|
/**
|
708
708
|
*
|
709
709
|
* @ngdoc function
|
710
|
-
* @name
|
711
|
-
* @methodOf ng.$animate
|
710
|
+
* @name $animate#setClass
|
712
711
|
* @function
|
713
712
|
* @description Adds and/or removes the given CSS classes to and from the element.
|
714
713
|
* Once complete, the done() callback will be fired (if provided).
|
@@ -777,7 +776,7 @@ angular.module('ngAnimate', ['ng'])
|
|
777
776
|
fireDOMOperation();
|
778
777
|
fireBeforeCallbackAsync();
|
779
778
|
fireAfterCallbackAsync();
|
780
|
-
|
779
|
+
closeAnimation();
|
781
780
|
return;
|
782
781
|
}
|
783
782
|
|
@@ -956,7 +955,7 @@ angular.module('ngAnimate', ['ng'])
|
|
956
955
|
animation, but class-based animations don't. An example of this
|
957
956
|
failing would be when a parent HTML tag has a ng-class attribute
|
958
957
|
causing ALL directives below to skip animations during the digest */
|
959
|
-
if(runner.isClassBased) {
|
958
|
+
if(runner && runner.isClassBased) {
|
960
959
|
cleanup(element, className);
|
961
960
|
} else {
|
962
961
|
$$asyncCallback(function() {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.15
|
3
3
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -30,8 +30,9 @@ angular.module('ngCookies', ['ng']).
|
|
30
30
|
* @description
|
31
31
|
* Provides read/write access to browser's cookies.
|
32
32
|
*
|
33
|
-
* Only a simple Object is exposed and by adding or removing properties to/from
|
34
|
-
*
|
33
|
+
* Only a simple Object is exposed and by adding or removing properties to/from this object, new
|
34
|
+
* cookies are created/deleted at the end of current $eval.
|
35
|
+
* The object's properties can only be strings.
|
35
36
|
*
|
36
37
|
* Requires the {@link ngCookies `ngCookies`} module to be installed.
|
37
38
|
*
|
@@ -99,12 +100,10 @@ angular.module('ngCookies', ['ng']).
|
|
99
100
|
for(name in cookies) {
|
100
101
|
value = cookies[name];
|
101
102
|
if (!angular.isString(value)) {
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
}
|
107
|
-
} else if (value !== lastCookies[name]) {
|
103
|
+
value = '' + value;
|
104
|
+
cookies[name] = value;
|
105
|
+
}
|
106
|
+
if (value !== lastCookies[name]) {
|
108
107
|
$browser.cookies(name, value);
|
109
108
|
updated = true;
|
110
109
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.15
|
3
3
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -69,7 +69,7 @@ function minErr(module) {
|
|
69
69
|
return match;
|
70
70
|
});
|
71
71
|
|
72
|
-
message = message + '\nhttp://errors.angularjs.org/1.2.
|
72
|
+
message = message + '\nhttp://errors.angularjs.org/1.2.15/' +
|
73
73
|
(module ? module + '/' : '') + code;
|
74
74
|
for (i = 2; i < arguments.length; i++) {
|
75
75
|
message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
|
@@ -135,16 +135,16 @@ function setupModuleLoader(window) {
|
|
135
135
|
* myModule.value('appName', 'MyCoolApp');
|
136
136
|
*
|
137
137
|
* // configure existing services inside initialization blocks.
|
138
|
-
* myModule.config(function($locationProvider) {
|
138
|
+
* myModule.config(['$locationProvider', function($locationProvider) {
|
139
139
|
* // Configure existing providers
|
140
140
|
* $locationProvider.hashPrefix('!');
|
141
|
-
* });
|
141
|
+
* }]);
|
142
142
|
* ```
|
143
143
|
*
|
144
144
|
* Then you can create an injector and load your modules like this:
|
145
145
|
*
|
146
146
|
* ```js
|
147
|
-
* var injector = angular.injector(['ng', '
|
147
|
+
* var injector = angular.injector(['ng', 'myModule'])
|
148
148
|
* ```
|
149
149
|
*
|
150
150
|
* However it's more likely that you'll just use
|
@@ -153,7 +153,7 @@ function setupModuleLoader(window) {
|
|
153
153
|
*
|
154
154
|
* @param {!string} name The name of the module to create or retrieve.
|
155
155
|
* @param {Array.<string>=} requires If specified then new module is being created. If
|
156
|
-
* unspecified then the
|
156
|
+
* unspecified then the module is being retrieved for further configuration.
|
157
157
|
* @param {Function} configFn Optional configuration function for the module. Same as
|
158
158
|
* {@link angular.Module#config Module#config()}.
|
159
159
|
* @returns {module} new module with the {@link angular.Module} api.
|
@@ -194,7 +194,6 @@ function setupModuleLoader(window) {
|
|
194
194
|
* @ngdoc property
|
195
195
|
* @name angular.Module#requires
|
196
196
|
* @module ng
|
197
|
-
* @propertyOf angular.Module
|
198
197
|
* @returns {Array.<string>} List of module names which must be loaded before this module.
|
199
198
|
* @description
|
200
199
|
* Holds the list of modules which the injector will load before the current module is
|
@@ -206,7 +205,6 @@ function setupModuleLoader(window) {
|
|
206
205
|
* @ngdoc property
|
207
206
|
* @name angular.Module#name
|
208
207
|
* @module ng
|
209
|
-
* @propertyOf angular.Module
|
210
208
|
* @returns {string} Name of the module.
|
211
209
|
* @description
|
212
210
|
*/
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.15
|
3
3
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -505,7 +505,7 @@ angular.mock.$IntervalProvider = function() {
|
|
505
505
|
* @description
|
506
506
|
* Cancels a task associated with the `promise`.
|
507
507
|
*
|
508
|
-
* @param {
|
508
|
+
* @param {promise} promise A promise from calling the `$interval` function.
|
509
509
|
* @returns {boolean} Returns `true` if the task was successfully cancelled.
|
510
510
|
*/
|
511
511
|
$interval.cancel = function(promise) {
|
@@ -967,13 +967,12 @@ angular.mock.dump = function(object) {
|
|
967
967
|
*
|
968
968
|
* # Flushing HTTP requests
|
969
969
|
*
|
970
|
-
* The $httpBackend used in production always responds to requests
|
971
|
-
*
|
972
|
-
*
|
973
|
-
*
|
974
|
-
*
|
975
|
-
*
|
976
|
-
* synchronously.
|
970
|
+
* The $httpBackend used in production always responds to requests asynchronously. If we preserved
|
971
|
+
* this behavior in unit testing, we'd have to create async unit tests, which are hard to write,
|
972
|
+
* to follow and to maintain. But neither can the testing mock respond synchronously; that would
|
973
|
+
* change the execution of the code under test. For this reason, the mock $httpBackend has a
|
974
|
+
* `flush()` method, which allows the test to explicitly flush pending requests. This preserves
|
975
|
+
* the async api of the backend, while allowing the test to execute synchronously.
|
977
976
|
*
|
978
977
|
*
|
979
978
|
* # Unit testing with mock $httpBackend
|
@@ -1829,8 +1828,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
1829
1828
|
* an array containing response status (number), response data (string) and response headers
|
1830
1829
|
* (Object).
|
1831
1830
|
* - passThrough – `{function()}` – Any request matching a backend definition with `passThrough`
|
1832
|
-
* handler
|
1833
|
-
* server.
|
1831
|
+
* handler will be passed through to the real backend (an XHR request will be made to the
|
1832
|
+
* server.)
|
1834
1833
|
*/
|
1835
1834
|
|
1836
1835
|
/**
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.15
|
3
3
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -102,7 +102,7 @@ function shallowClearAndCopy(src, dst) {
|
|
102
102
|
* If the parameter value is prefixed with `@` then the value of that parameter is extracted from
|
103
103
|
* the data object (useful for non-GET operations).
|
104
104
|
*
|
105
|
-
* @param {Object
|
105
|
+
* @param {Object.<Object>=} actions Hash with declaration of custom action that should extend
|
106
106
|
* the default set of resource actions. The declaration should be created in the format of {@link
|
107
107
|
* ng.$http#usage_parameters $http.config}:
|
108
108
|
*
|
@@ -258,7 +258,7 @@ function shallowClearAndCopy(src, dst) {
|
|
258
258
|
|
259
259
|
```js
|
260
260
|
var User = $resource('/user/:userId', {userId:'@id'});
|
261
|
-
|
261
|
+
User.get({userId:123}, function(user) {
|
262
262
|
user.abc = true;
|
263
263
|
user.$save();
|
264
264
|
});
|
@@ -278,6 +278,16 @@ function shallowClearAndCopy(src, dst) {
|
|
278
278
|
});
|
279
279
|
});
|
280
280
|
```
|
281
|
+
*
|
282
|
+
* You can also access the raw `$http` promise via the `$promise` property on the object returned
|
283
|
+
*
|
284
|
+
```
|
285
|
+
var User = $resource('/user/:userId', {userId:'@id'});
|
286
|
+
User.get({userId:123})
|
287
|
+
.$promise.then(function(user) {
|
288
|
+
$scope.user = user;
|
289
|
+
});
|
290
|
+
```
|
281
291
|
|
282
292
|
* # Creating a custom 'PUT' request
|
283
293
|
* In this example we create a custom method on our resource to make a PUT request
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.15
|
3
3
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -87,7 +87,7 @@ function $RouteProvider(){
|
|
87
87
|
*
|
88
88
|
* If `template` is a function, it will be called with the following parameters:
|
89
89
|
*
|
90
|
-
* - `{Array
|
90
|
+
* - `{Array.<Object>}` - route parameters extracted from the current
|
91
91
|
* `$location.path()` by applying the current route
|
92
92
|
*
|
93
93
|
* - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html
|
@@ -95,7 +95,7 @@ function $RouteProvider(){
|
|
95
95
|
*
|
96
96
|
* If `templateUrl` is a function, it will be called with the following parameters:
|
97
97
|
*
|
98
|
-
* - `{Array
|
98
|
+
* - `{Array.<Object>}` - route parameters extracted from the current
|
99
99
|
* `$location.path()` by applying the current route
|
100
100
|
*
|
101
101
|
* - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should
|
@@ -252,7 +252,7 @@ function $RouteProvider(){
|
|
252
252
|
* - `$scope` - The current route scope.
|
253
253
|
* - `$template` - The current route template HTML.
|
254
254
|
*
|
255
|
-
* @property {
|
255
|
+
* @property {Object} routes Object with all route configuration Objects as its properties.
|
256
256
|
*
|
257
257
|
* @description
|
258
258
|
* `$route` is used for deep-linking URLs to controllers and views (HTML partials).
|
@@ -267,102 +267,106 @@ function $RouteProvider(){
|
|
267
267
|
* {@link ngRoute.$routeParams `$routeParams`} service.
|
268
268
|
*
|
269
269
|
* @example
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
<example name="$route-service" module="ngRouteExample"
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
</
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
$
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
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
|
+
* Note that this example is using {@link ng.directive:script inlined templates}
|
274
|
+
* to get it working on jsfiddle as well.
|
275
|
+
*
|
276
|
+
* <example name="$route-service" module="ngRouteExample"
|
277
|
+
* deps="angular-route.js" fixBase="true">
|
278
|
+
* <file name="index.html">
|
279
|
+
* <div ng-controller="MainController">
|
280
|
+
* Choose:
|
281
|
+
* <a href="Book/Moby">Moby</a> |
|
282
|
+
* <a href="Book/Moby/ch/1">Moby: Ch1</a> |
|
283
|
+
* <a href="Book/Gatsby">Gatsby</a> |
|
284
|
+
* <a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
|
285
|
+
* <a href="Book/Scarlet">Scarlet Letter</a><br/>
|
286
|
+
*
|
287
|
+
* <div ng-view></div>
|
288
|
+
*
|
289
|
+
* <hr />
|
290
|
+
*
|
291
|
+
* <pre>$location.path() = {{$location.path()}}</pre>
|
292
|
+
* <pre>$route.current.templateUrl = {{$route.current.templateUrl}}</pre>
|
293
|
+
* <pre>$route.current.params = {{$route.current.params}}</pre>
|
294
|
+
* <pre>$route.current.scope.name = {{$route.current.scope.name}}</pre>
|
295
|
+
* <pre>$routeParams = {{$routeParams}}</pre>
|
296
|
+
* </div>
|
297
|
+
* </file>
|
298
|
+
*
|
299
|
+
* <file name="book.html">
|
300
|
+
* controller: {{name}}<br />
|
301
|
+
* Book Id: {{params.bookId}}<br />
|
302
|
+
* </file>
|
303
|
+
*
|
304
|
+
* <file name="chapter.html">
|
305
|
+
* controller: {{name}}<br />
|
306
|
+
* Book Id: {{params.bookId}}<br />
|
307
|
+
* Chapter Id: {{params.chapterId}}
|
308
|
+
* </file>
|
309
|
+
*
|
310
|
+
* <file name="script.js">
|
311
|
+
* angular.module('ngRouteExample', ['ngRoute'])
|
312
|
+
*
|
313
|
+
* .controller('MainController', function($scope, $route, $routeParams, $location) {
|
314
|
+
* $scope.$route = $route;
|
315
|
+
* $scope.$location = $location;
|
316
|
+
* $scope.$routeParams = $routeParams;
|
317
|
+
* })
|
318
|
+
*
|
319
|
+
* .controller('BookController', function($scope, $routeParams) {
|
320
|
+
* $scope.name = "BookController";
|
321
|
+
* $scope.params = $routeParams;
|
322
|
+
* })
|
323
|
+
*
|
324
|
+
* .controller('ChapterController', function($scope, $routeParams) {
|
325
|
+
* $scope.name = "ChapterController";
|
326
|
+
* $scope.params = $routeParams;
|
327
|
+
* })
|
328
|
+
*
|
329
|
+
* .config(function($routeProvider, $locationProvider) {
|
330
|
+
* $routeProvider
|
331
|
+
* .when('/Book/:bookId', {
|
332
|
+
* templateUrl: 'book.html',
|
333
|
+
* controller: 'BookController',
|
334
|
+
* resolve: {
|
335
|
+
* // I will cause a 1 second delay
|
336
|
+
* delay: function($q, $timeout) {
|
337
|
+
* var delay = $q.defer();
|
338
|
+
* $timeout(delay.resolve, 1000);
|
339
|
+
* return delay.promise;
|
340
|
+
* }
|
341
|
+
* }
|
342
|
+
* })
|
343
|
+
* .when('/Book/:bookId/ch/:chapterId', {
|
344
|
+
* templateUrl: 'chapter.html',
|
345
|
+
* controller: 'ChapterController'
|
346
|
+
* });
|
347
|
+
*
|
348
|
+
* // configure html5 to get links working on jsfiddle
|
349
|
+
* $locationProvider.html5Mode(true);
|
350
|
+
* });
|
351
|
+
*
|
352
|
+
* </file>
|
353
|
+
*
|
354
|
+
* <file name="protractor.js" type="protractor">
|
355
|
+
* it('should load and compile correct template', function() {
|
356
|
+
* element(by.linkText('Moby: Ch1')).click();
|
357
|
+
* var content = element(by.css('[ng-view]')).getText();
|
358
|
+
* expect(content).toMatch(/controller\: ChapterController/);
|
359
|
+
* expect(content).toMatch(/Book Id\: Moby/);
|
360
|
+
* expect(content).toMatch(/Chapter Id\: 1/);
|
361
|
+
*
|
362
|
+
* element(by.partialLinkText('Scarlet')).click();
|
363
|
+
*
|
364
|
+
* content = element(by.css('[ng-view]')).getText();
|
365
|
+
* expect(content).toMatch(/controller\: BookController/);
|
366
|
+
* expect(content).toMatch(/Book Id\: Scarlet/);
|
367
|
+
* });
|
368
|
+
* </file>
|
369
|
+
* </example>
|
366
370
|
*/
|
367
371
|
|
368
372
|
/**
|
@@ -675,7 +679,7 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
|
|
675
679
|
deps="angular-route.js;angular-animate.js"
|
676
680
|
animations="true" fixBase="true">
|
677
681
|
<file name="index.html">
|
678
|
-
<div ng-controller="
|
682
|
+
<div ng-controller="MainCtrl as main">
|
679
683
|
Choose:
|
680
684
|
<a href="Book/Moby">Moby</a> |
|
681
685
|
<a href="Book/Moby/ch/1">Moby: Ch1</a> |
|
@@ -754,52 +758,53 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
|
|
754
758
|
</file>
|
755
759
|
|
756
760
|
<file name="script.js">
|
757
|
-
angular.module('ngViewExample', ['ngRoute', 'ngAnimate']
|
758
|
-
|
759
|
-
$routeProvider
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
761
|
+
angular.module('ngViewExample', ['ngRoute', 'ngAnimate'])
|
762
|
+
.config(['$routeProvider', '$locationProvider',
|
763
|
+
function($routeProvider, $locationProvider) {
|
764
|
+
$routeProvider
|
765
|
+
.when('/Book/:bookId', {
|
766
|
+
templateUrl: 'book.html',
|
767
|
+
controller: 'BookCtrl',
|
768
|
+
controllerAs: 'book'
|
769
|
+
})
|
770
|
+
.when('/Book/:bookId/ch/:chapterId', {
|
771
|
+
templateUrl: 'chapter.html',
|
772
|
+
controller: 'ChapterCtrl',
|
773
|
+
controllerAs: 'chapter'
|
774
|
+
});
|
775
|
+
|
776
|
+
// configure html5 to get links working on jsfiddle
|
777
|
+
$locationProvider.html5Mode(true);
|
778
|
+
}])
|
779
|
+
.controller('MainCtrl', ['$route', '$routeParams', '$location',
|
780
|
+
function($route, $routeParams, $location) {
|
781
|
+
this.$route = $route;
|
782
|
+
this.$location = $location;
|
783
|
+
this.$routeParams = $routeParams;
|
784
|
+
}])
|
785
|
+
.controller('BookCtrl', ['$routeParams', function($routeParams) {
|
786
|
+
this.name = "BookCtrl";
|
787
|
+
this.params = $routeParams;
|
788
|
+
}])
|
789
|
+
.controller('ChapterCtrl', ['$routeParams', function($routeParams) {
|
790
|
+
this.name = "ChapterCtrl";
|
791
|
+
this.params = $routeParams;
|
792
|
+
}]);
|
769
793
|
|
770
|
-
// configure html5 to get links working on jsfiddle
|
771
|
-
$locationProvider.html5Mode(true);
|
772
|
-
});
|
773
|
-
|
774
|
-
function MainCntl($route, $routeParams, $location) {
|
775
|
-
this.$route = $route;
|
776
|
-
this.$location = $location;
|
777
|
-
this.$routeParams = $routeParams;
|
778
|
-
}
|
779
|
-
|
780
|
-
function BookCntl($routeParams) {
|
781
|
-
this.name = "BookCntl";
|
782
|
-
this.params = $routeParams;
|
783
|
-
}
|
784
|
-
|
785
|
-
function ChapterCntl($routeParams) {
|
786
|
-
this.name = "ChapterCntl";
|
787
|
-
this.params = $routeParams;
|
788
|
-
}
|
789
794
|
</file>
|
790
795
|
|
791
796
|
<file name="protractor.js" type="protractor">
|
792
797
|
it('should load and compile correct template', function() {
|
793
798
|
element(by.linkText('Moby: Ch1')).click();
|
794
799
|
var content = element(by.css('[ng-view]')).getText();
|
795
|
-
expect(content).toMatch(/controller\:
|
800
|
+
expect(content).toMatch(/controller\: ChapterCtrl/);
|
796
801
|
expect(content).toMatch(/Book Id\: Moby/);
|
797
802
|
expect(content).toMatch(/Chapter Id\: 1/);
|
798
803
|
|
799
804
|
element(by.partialLinkText('Scarlet')).click();
|
800
805
|
|
801
806
|
content = element(by.css('[ng-view]')).getText();
|
802
|
-
expect(content).toMatch(/controller\:
|
807
|
+
expect(content).toMatch(/controller\: BookCtrl/);
|
803
808
|
expect(content).toMatch(/Book Id\: Scarlet/);
|
804
809
|
});
|
805
810
|
</file>
|