angularjs-rails 1.2.0.rc2 → 1.2.0.rc3

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.2.0-rc.2
2
+ * @license AngularJS v1.2.0-rc.3
3
3
  * (c) 2010-2012 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.2.0-rc.2
2
+ * @license AngularJS v1.2.0-rc.3
3
3
  * (c) 2010-2012 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -16,6 +16,8 @@
16
16
 
17
17
  function setupModuleLoader(window) {
18
18
 
19
+ var $injectorMinErr = minErr('$injector');
20
+
19
21
  function ensure(obj, name, factory) {
20
22
  return obj[name] || (obj[name] = factory());
21
23
  }
@@ -74,12 +76,13 @@ function setupModuleLoader(window) {
74
76
  * @returns {module} new module with the {@link angular.Module} api.
75
77
  */
76
78
  return function module(name, requires, configFn) {
79
+ assertNotHasOwnProperty(name, 'module');
77
80
  if (requires && modules.hasOwnProperty(name)) {
78
81
  modules[name] = null;
79
82
  }
80
83
  return ensure(modules, name, function() {
81
84
  if (!requires) {
82
- throw minErr('$injector')('nomod', "Module '{0}' is not available! You either misspelled the module name " +
85
+ throw $injectorMinErr('nomod', "Module '{0}' is not available! You either misspelled the module name " +
83
86
  "or forgot to load it. If registering a module ensure that you specify the dependencies as the second " +
84
87
  "argument.", name);
85
88
  }
@@ -182,7 +185,7 @@ function setupModuleLoader(window) {
182
185
  * @param {Function} animationFactory Factory function for creating new instance of an animation.
183
186
  * @description
184
187
  *
185
- * **NOTE**: animations are take effect only if the **ngAnimate** module is loaded.
188
+ * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.
186
189
  *
187
190
  *
188
191
  * Defines an animation hook that can be later used with {@link ngAnimate.$animate $animate} service and
@@ -222,7 +225,8 @@ function setupModuleLoader(window) {
222
225
  * @ngdoc method
223
226
  * @name angular.Module#controller
224
227
  * @methodOf angular.Module
225
- * @param {string} name Controller name.
228
+ * @param {string|Object} name Controller name, or an object map of controllers where the
229
+ * keys are the names and the values are the constructors.
226
230
  * @param {Function} constructor Controller constructor function.
227
231
  * @description
228
232
  * See {@link ng.$controllerProvider#register $controllerProvider.register()}.
@@ -233,7 +237,8 @@ function setupModuleLoader(window) {
233
237
  * @ngdoc method
234
238
  * @name angular.Module#directive
235
239
  * @methodOf angular.Module
236
- * @param {string} name directive name
240
+ * @param {string|Object} name Directive name, or an object map of directives where the
241
+ * keys are the names and the values are the factories.
237
242
  * @param {Function} directiveFactory Factory function for creating new instance of
238
243
  * directives.
239
244
  * @description
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.2.0-rc.2
2
+ * @license AngularJS v1.2.0-rc.3
3
3
  * (c) 2010-2012 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  *
@@ -75,6 +75,13 @@ angular.mock.$Browser = function() {
75
75
  };
76
76
 
77
77
 
78
+ /**
79
+ * @name ngMock.$browser#defer.now
80
+ * @propertyOf ngMock.$browser
81
+ *
82
+ * @description
83
+ * Current milliseconds mock time.
84
+ */
78
85
  self.defer.now = 0;
79
86
 
80
87
 
@@ -119,29 +126,6 @@ angular.mock.$Browser = function() {
119
126
  }
120
127
  };
121
128
 
122
- /**
123
- * @name ngMock.$browser#defer.flushNext
124
- * @methodOf ngMock.$browser
125
- *
126
- * @description
127
- * Flushes next pending request and compares it to the provided delay
128
- *
129
- * @param {number=} expectedDelay the delay value that will be asserted against the delay of the next timeout function
130
- */
131
- self.defer.flushNext = function(expectedDelay) {
132
- var tick = self.deferredFns.shift();
133
- expect(tick.time).toEqual(expectedDelay);
134
- tick.fn();
135
- };
136
-
137
- /**
138
- * @name ngMock.$browser#defer.now
139
- * @propertyOf ngMock.$browser
140
- *
141
- * @description
142
- * Current milliseconds mock time.
143
- */
144
-
145
129
  self.$$baseHref = '';
146
130
  self.baseHref = function() {
147
131
  return this.$$baseHref;
@@ -454,6 +438,119 @@ angular.mock.$LogProvider = function() {
454
438
  };
455
439
 
456
440
 
441
+ /**
442
+ * @ngdoc service
443
+ * @name ngMock.$interval
444
+ *
445
+ * @description
446
+ * Mock implementation of the $interval service.
447
+ *
448
+ * Use {@link ngMock.$interval#flush `$interval.flush(millis)`} to
449
+ * move forward by `millis` milliseconds and trigger any functions scheduled to run in that
450
+ * time.
451
+ *
452
+ * @param {function()} fn A function that should be called repeatedly.
453
+ * @param {number} delay Number of milliseconds between each function call.
454
+ * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat
455
+ * indefinitely.
456
+ * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
457
+ * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
458
+ * @returns {promise} A promise which will be notified on each iteration.
459
+ */
460
+ angular.mock.$IntervalProvider = function() {
461
+ this.$get = ['$rootScope', '$q',
462
+ function($rootScope, $q) {
463
+ var repeatFns = [],
464
+ nextRepeatId = 0,
465
+ now = 0;
466
+
467
+ var $interval = function(fn, delay, count, invokeApply) {
468
+ var deferred = $q.defer(),
469
+ promise = deferred.promise,
470
+ count = (angular.isDefined(count)) ? count : 0,
471
+ iteration = 0,
472
+ skipApply = (angular.isDefined(invokeApply) && !invokeApply);
473
+
474
+ promise.then(null, null, fn);
475
+
476
+ promise.$$intervalId = nextRepeatId;
477
+
478
+ function tick() {
479
+ deferred.notify(iteration++);
480
+
481
+ if (count > 0 && iteration >= count) {
482
+ var fnIndex;
483
+ deferred.resolve(iteration);
484
+
485
+ angular.forEach(repeatFns, function(fn, index) {
486
+ if (fn.id === promise.$$intervalId) fnIndex = index;
487
+ });
488
+
489
+ if (fnIndex !== undefined) {
490
+ repeatFns.splice(fnIndex, 1);
491
+ }
492
+ }
493
+
494
+ if (!skipApply) $rootScope.$apply();
495
+ };
496
+
497
+ repeatFns.push({
498
+ nextTime:(now + delay),
499
+ delay: delay,
500
+ fn: tick,
501
+ id: nextRepeatId,
502
+ deferred: deferred
503
+ });
504
+ repeatFns.sort(function(a,b){ return a.nextTime - b.nextTime;});
505
+
506
+ nextRepeatId++;
507
+ return promise;
508
+ };
509
+
510
+ $interval.cancel = function(promise) {
511
+ var fnIndex;
512
+
513
+ angular.forEach(repeatFns, function(fn, index) {
514
+ if (fn.id === promise.$$intervalId) fnIndex = index;
515
+ });
516
+
517
+ if (fnIndex !== undefined) {
518
+ repeatFns[fnIndex].deferred.reject('canceled');
519
+ repeatFns.splice(fnIndex, 1);
520
+ return true;
521
+ }
522
+
523
+ return false;
524
+ };
525
+
526
+ /**
527
+ * @ngdoc method
528
+ * @name ngMock.$interval#flush
529
+ * @methodOf ngMock.$interval
530
+ * @description
531
+ *
532
+ * Runs interval tasks scheduled to be run in the next `millis` milliseconds.
533
+ *
534
+ * @param {number=} millis maximum timeout amount to flush up until.
535
+ *
536
+ * @return {number} The amount of time moved forward.
537
+ */
538
+ $interval.flush = function(millis) {
539
+ now += millis;
540
+ while (repeatFns.length && repeatFns[0].nextTime <= now) {
541
+ var task = repeatFns[0];
542
+ task.fn();
543
+ task.nextTime += task.delay;
544
+ repeatFns.sort(function(a,b){ return a.nextTime - b.nextTime;});
545
+ }
546
+ return millis;
547
+ };
548
+
549
+ return $interval;
550
+ }];
551
+ };
552
+
553
+
457
554
  (function() {
458
555
  var R_ISO8061_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?:\:?(\d\d)(?:\:?(\d\d)(?:\.(\d{3}))?)?)?(Z|([+-])(\d\d):?(\d\d)))?$/;
459
556
 
@@ -672,7 +769,7 @@ angular.mock.animate = angular.module('mock.animate', ['ng'])
672
769
  }
673
770
  };
674
771
 
675
- forEach(['enter','leave','move','addClass','removeClass'], function(method) {
772
+ angular.forEach(['enter','leave','move','addClass','removeClass'], function(method) {
676
773
  animate[method] = function() {
677
774
  var params = arguments;
678
775
  animate.queue.push({
@@ -747,7 +844,7 @@ angular.mock.dump = function(object) {
747
844
  offset = offset || ' ';
748
845
  var log = [offset + 'Scope(' + scope.$id + '): {'];
749
846
  for ( var key in scope ) {
750
- if (scope.hasOwnProperty(key) && !key.match(/^(\$|this)/)) {
847
+ if (Object.prototype.hasOwnProperty.call(scope, key) && !key.match(/^(\$|this)/)) {
751
848
  log.push(' ' + key + ': ' + angular.toJson(scope[key]));
752
849
  }
753
850
  }
@@ -1597,6 +1694,7 @@ angular.module('ngMock', ['ng']).provider({
1597
1694
  $browser: angular.mock.$BrowserProvider,
1598
1695
  $exceptionHandler: angular.mock.$ExceptionHandlerProvider,
1599
1696
  $log: angular.mock.$LogProvider,
1697
+ $interval: angular.mock.$IntervalProvider,
1600
1698
  $httpBackend: angular.mock.$HttpBackendProvider,
1601
1699
  $rootElement: angular.mock.$RootElementProvider
1602
1700
  }).config(function($provide) {
@@ -1789,7 +1887,7 @@ angular.mock.clearDataCache = function() {
1789
1887
  cache = angular.element.cache;
1790
1888
 
1791
1889
  for(key in cache) {
1792
- if (cache.hasOwnProperty(key)) {
1890
+ if (Object.prototype.hasOwnProperty.call(cache,key)) {
1793
1891
  var handle = cache[key].handle;
1794
1892
 
1795
1893
  handle && angular.element(handle.elem).off();
@@ -1892,8 +1990,40 @@ angular.mock.clearDataCache = function() {
1892
1990
  * instance of {@link AUTO.$injector $injector} per test, which is then used for
1893
1991
  * resolving references.
1894
1992
  *
1895
- * See also {@link angular.mock.module module}
1896
1993
  *
1994
+ * ## Resolving References (Underscore Wrapping)
1995
+ * Often, we would like to inject a reference once, in a `beforeEach()` block and reuse this
1996
+ * in multiple `it()` clauses. To be able to do this we must assign the reference to a variable
1997
+ * that is declared in the scope of the `describe()` block. Since we would, most likely, want
1998
+ * the variable to have the same name of the reference we have a problem, since the parameter
1999
+ * to the `inject()` function would hide the outer variable.
2000
+ *
2001
+ * To help with this, the injected parameters can, optionally, be enclosed with underscores.
2002
+ * These are ignored by the injector when the reference name is resolved.
2003
+ *
2004
+ * For example, the parameter `_myService_` would be resolved as the reference `myService`.
2005
+ * Since it is available in the function body as _myService_, we can then assign it to a variable
2006
+ * defined in an outer scope.
2007
+ *
2008
+ * ```
2009
+ * // Defined out reference variable outside
2010
+ * var myService;
2011
+ *
2012
+ * // Wrap the parameter in underscores
2013
+ * beforeEach( inject( function(_myService_){
2014
+ * myService = _myService_;
2015
+ * }));
2016
+ *
2017
+ * // Use myService in a series of tests.
2018
+ * it('makes use of myService', function() {
2019
+ * myService.doStuff();
2020
+ * });
2021
+ *
2022
+ * ```
2023
+ *
2024
+ * See also {@link angular.mock.module angular.mock.module}
2025
+ *
2026
+ * ## Example
1897
2027
  * Example of what a typical jasmine tests looks like with the inject method.
1898
2028
  * <pre>
1899
2029
  *
@@ -1926,11 +2056,11 @@ angular.mock.clearDataCache = function() {
1926
2056
  * inject(function(version) {
1927
2057
  * expect(version).toEqual('overridden');
1928
2058
  * });
1929
- * ));
2059
+ * });
1930
2060
  * });
1931
2061
  *
1932
2062
  * </pre>
1933
- *
2063
+ *
1934
2064
  * @param {...Function} fns any number of functions which will be injected using the injector.
1935
2065
  */
1936
2066
  window.inject = angular.mock.inject = function() {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.2.0-rc.2
2
+ * @license AngularJS v1.2.0-rc.3
3
3
  * (c) 2010-2012 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -16,7 +16,7 @@ var $resourceMinErr = angular.$$minErr('$resource');
16
16
  *
17
17
  * `ngResource` is the name of the optional Angular module that adds support for interacting with
18
18
  * [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources.
19
- * `ngReource` provides the {@link ngResource.$resource `$resource`} serivce.
19
+ * `ngResource` provides the {@link ngResource.$resource `$resource`} service.
20
20
  *
21
21
  * {@installModule resource}
22
22
  *
@@ -94,7 +94,7 @@ var $resourceMinErr = angular.$$minErr('$resource');
94
94
  * caching.
95
95
  * - **`timeout`** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise} that
96
96
  * should abort the request when resolved.
97
- * - **`withCredentials`** - `{boolean}` - whether to to set the `withCredentials` flag on the
97
+ * - **`withCredentials`** - `{boolean}` - whether to set the `withCredentials` flag on the
98
98
  * XHR object. See {@link https://developer.mozilla.org/en/http_access_control#section_5
99
99
  * requests with credentials} for more information.
100
100
  * - **`responseType`** - `{string}` - see {@link
@@ -352,6 +352,9 @@ angular.module('ngResource', ['ng']).
352
352
 
353
353
  var urlParams = self.urlParams = {};
354
354
  forEach(url.split(/\W/), function(param){
355
+ if (param === 'hasOwnProperty') {
356
+ throw $resourceMinErr('badname', "hasOwnProperty is not a valid parameter name.");
357
+ }
355
358
  if (!(new RegExp("^\\d+$").test(param)) && param && (new RegExp("(^|[^\\\\]):" + param + "(\\W|$)").test(url))) {
356
359
  urlParams[param] = true;
357
360
  }
@@ -471,7 +474,7 @@ angular.module('ngResource', ['ng']).
471
474
  }
472
475
  });
473
476
 
474
- httpConfig.data = data;
477
+ if (hasBody) httpConfig.data = data;
475
478
  route.setUrlParams(httpConfig, extend({}, extractParams(data, action.params || {}), params), action.url);
476
479
 
477
480
  var promise = $http(httpConfig).then(function(response) {
@@ -497,8 +500,6 @@ angular.module('ngResource', ['ng']).
497
500
 
498
501
  value.$resolved = true;
499
502
 
500
- (success||noop)(value, response.headers);
501
-
502
503
  response.resource = value;
503
504
 
504
505
  return response;
@@ -508,8 +509,15 @@ angular.module('ngResource', ['ng']).
508
509
  (error||noop)(response);
509
510
 
510
511
  return $q.reject(response);
511
- }).then(responseInterceptor, responseErrorInterceptor);
512
+ });
512
513
 
514
+ promise = promise.then(
515
+ function(response) {
516
+ var value = responseInterceptor(response);
517
+ (success||noop)(value, response.headers);
518
+ return value;
519
+ },
520
+ responseErrorInterceptor);
513
521
 
514
522
  if (!isInstanceCall) {
515
523
  // we are creating instance / collection
@@ -1,26 +1,10 @@
1
1
  /**
2
- * @license AngularJS v1.2.0-rc.2
2
+ * @license AngularJS v1.2.0-rc.3
3
3
  * (c) 2010-2012 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
6
6
  (function(window, angular, undefined) {'use strict';
7
7
 
8
- var copy = angular.copy,
9
- equals = angular.equals,
10
- extend = angular.extend,
11
- forEach = angular.forEach,
12
- isDefined = angular.isDefined,
13
- isFunction = angular.isFunction,
14
- isString = angular.isString,
15
- jqLite = angular.element,
16
- noop = angular.noop,
17
- toJson = angular.toJson;
18
-
19
-
20
- function inherit(parent, extra) {
21
- return extend(new (extend(function() {}, {prototype:parent}))(), extra);
22
- }
23
-
24
8
  /**
25
9
  * @ngdoc overview
26
10
  * @name ngRoute
@@ -49,6 +33,10 @@ var ngRouteModule = angular.module('ngRoute', ['ng']).
49
33
  * Requires the {@link ngRoute `ngRoute`} module to be installed.
50
34
  */
51
35
  function $RouteProvider(){
36
+ function inherit(parent, extra) {
37
+ return angular.extend(new (angular.extend(function() {}, {prototype:parent}))(), extra);
38
+ }
39
+
52
40
  var routes = {};
53
41
 
54
42
  /**
@@ -130,8 +118,8 @@ function $RouteProvider(){
130
118
  * The custom `redirectTo` function is expected to return a string which will be used
131
119
  * to update `$location.path()` and `$location.search()`.
132
120
  *
133
- * - `[reloadOnSearch=true]` - {boolean=} - reload route when only $location.search()
134
- * changes.
121
+ * - `[reloadOnSearch=true]` - {boolean=} - reload route when only `$location.search()`
122
+ * or `$location.hash()` changes.
135
123
  *
136
124
  * If the option is set to `false` and url in the browser changes, then
137
125
  * `$routeUpdate` event is broadcasted on the root scope.
@@ -147,7 +135,7 @@ function $RouteProvider(){
147
135
  * Adds a new route definition to the `$route` service.
148
136
  */
149
137
  this.when = function(path, route) {
150
- routes[path] = extend(
138
+ routes[path] = angular.extend(
151
139
  {reloadOnSearch: true},
152
140
  route,
153
141
  path && pathRegExp(path, route)
@@ -159,7 +147,7 @@ function $RouteProvider(){
159
147
  ? path.substr(0, path.length-1)
160
148
  : path +'/';
161
149
 
162
- routes[redirectPath] = extend(
150
+ routes[redirectPath] = angular.extend(
163
151
  {redirectTo: path},
164
152
  pathRegExp(redirectPath, route)
165
153
  );
@@ -198,7 +186,9 @@ function $RouteProvider(){
198
186
  + (optional ? '' : slash)
199
187
  + '(?:'
200
188
  + (optional ? slash : '')
201
- + (star && '(.+)?' || '([^/]+)?') + ')'
189
+ + (star && '(.+?)' || '([^/]+)')
190
+ + (optional || '')
191
+ + ')'
202
192
  + (optional || '');
203
193
  })
204
194
  .replace(/([\/$\*])/g, '\\$1');
@@ -367,6 +357,7 @@ function $RouteProvider(){
367
357
  * defined in `resolve` route property. Once all of the dependencies are resolved
368
358
  * `$routeChangeSuccess` is fired.
369
359
  *
360
+ * @param {Object} angularEvent Synthetic event object.
370
361
  * @param {Route} next Future route information.
371
362
  * @param {Route} current Current route information.
372
363
  */
@@ -394,6 +385,7 @@ function $RouteProvider(){
394
385
  * @description
395
386
  * Broadcasted if any of the resolve promises are rejected.
396
387
  *
388
+ * @param {Object} angularEvent Synthetic event object
397
389
  * @param {Route} current Current route information.
398
390
  * @param {Route} previous Previous route information.
399
391
  * @param {Route} rejection Rejection of the promise. Usually the error of the failed promise.
@@ -477,9 +469,9 @@ function $RouteProvider(){
477
469
  last = $route.current;
478
470
 
479
471
  if (next && last && next.$$route === last.$$route
480
- && equals(next.pathParams, last.pathParams) && !next.reloadOnSearch && !forceReload) {
472
+ && angular.equals(next.pathParams, last.pathParams) && !next.reloadOnSearch && !forceReload) {
481
473
  last.params = next.params;
482
- copy(last.params, $routeParams);
474
+ angular.copy(last.params, $routeParams);
483
475
  $rootScope.$broadcast('$routeUpdate', last);
484
476
  } else if (next || last) {
485
477
  forceReload = false;
@@ -487,7 +479,7 @@ function $RouteProvider(){
487
479
  $route.current = next;
488
480
  if (next) {
489
481
  if (next.redirectTo) {
490
- if (isString(next.redirectTo)) {
482
+ if (angular.isString(next.redirectTo)) {
491
483
  $location.path(interpolate(next.redirectTo, next.params)).search(next.params)
492
484
  .replace();
493
485
  } else {
@@ -500,29 +492,29 @@ function $RouteProvider(){
500
492
  $q.when(next).
501
493
  then(function() {
502
494
  if (next) {
503
- var locals = extend({}, next.resolve),
495
+ var locals = angular.extend({}, next.resolve),
504
496
  template, templateUrl;
505
497
 
506
- forEach(locals, function(value, key) {
507
- locals[key] = isString(value) ? $injector.get(value) : $injector.invoke(value);
498
+ angular.forEach(locals, function(value, key) {
499
+ locals[key] = angular.isString(value) ? $injector.get(value) : $injector.invoke(value);
508
500
  });
509
501
 
510
- if (isDefined(template = next.template)) {
511
- if (isFunction(template)) {
502
+ if (angular.isDefined(template = next.template)) {
503
+ if (angular.isFunction(template)) {
512
504
  template = template(next.params);
513
505
  }
514
- } else if (isDefined(templateUrl = next.templateUrl)) {
515
- if (isFunction(templateUrl)) {
506
+ } else if (angular.isDefined(templateUrl = next.templateUrl)) {
507
+ if (angular.isFunction(templateUrl)) {
516
508
  templateUrl = templateUrl(next.params);
517
509
  }
518
510
  templateUrl = $sce.getTrustedResourceUrl(templateUrl);
519
- if (isDefined(templateUrl)) {
511
+ if (angular.isDefined(templateUrl)) {
520
512
  next.loadedTemplateUrl = templateUrl;
521
513
  template = $http.get(templateUrl, {cache: $templateCache}).
522
514
  then(function(response) { return response.data; });
523
515
  }
524
516
  }
525
- if (isDefined(template)) {
517
+ if (angular.isDefined(template)) {
526
518
  locals['$template'] = template;
527
519
  }
528
520
  return $q.all(locals);
@@ -533,7 +525,7 @@ function $RouteProvider(){
533
525
  if (next == $route.current) {
534
526
  if (next) {
535
527
  next.locals = locals;
536
- copy(next.params, $routeParams);
528
+ angular.copy(next.params, $routeParams);
537
529
  }
538
530
  $rootScope.$broadcast('$routeChangeSuccess', next, last);
539
531
  }
@@ -552,10 +544,10 @@ function $RouteProvider(){
552
544
  function parseRoute() {
553
545
  // Match a route
554
546
  var params, match;
555
- forEach(routes, function(route, path) {
547
+ angular.forEach(routes, function(route, path) {
556
548
  if (!match && (params = switchRouteMatcher($location.path(), route))) {
557
549
  match = inherit(route, {
558
- params: extend({}, $location.search(), params),
550
+ params: angular.extend({}, $location.search(), params),
559
551
  pathParams: params});
560
552
  match.$$route = route;
561
553
  }
@@ -569,7 +561,7 @@ function $RouteProvider(){
569
561
  */
570
562
  function interpolate(string, params) {
571
563
  var result = [];
572
- forEach((string||'').split(':'), function(segment, i) {
564
+ angular.forEach((string||'').split(':'), function(segment, i) {
573
565
  if (i === 0) {
574
566
  result.push(segment);
575
567
  } else {
@@ -648,6 +640,7 @@ ngRouteModule.directive('ngView', ngViewFactory);
648
640
  * The enter and leave animation occur concurrently.
649
641
  *
650
642
  * @scope
643
+ * @priority 400
651
644
  * @example
652
645
  <example module="ngViewExample" deps="angular-route.js" animations="true">
653
646
  <file name="index.html">
@@ -801,7 +794,7 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller,
801
794
  return {
802
795
  restrict: 'ECA',
803
796
  terminal: true,
804
- priority: 1000,
797
+ priority: 400,
805
798
  transclude: 'element',
806
799
  compile: function(element, attr, linker) {
807
800
  return function(scope, $element, attr) {
@@ -848,7 +841,7 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller,
848
841
  currentScope[current.controllerAs] = controller;
849
842
  }
850
843
  clone.data('$ngControllerController', controller);
851
- clone.contents().data('$ngControllerController', controller);
844
+ clone.children().data('$ngControllerController', controller);
852
845
  }
853
846
 
854
847
  link(currentScope);