angularjs-rails 1.0.1.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/angularjs-rails/version.rb +1 -1
- data/vendor/assets/javascripts/angular-bootstrap-prettify.js +1 -1
- data/vendor/assets/javascripts/angular-bootstrap.js +1 -1
- data/vendor/assets/javascripts/angular-cookies.js +1 -1
- data/vendor/assets/javascripts/angular-loader.js +2 -2
- data/vendor/assets/javascripts/angular-mocks.js +26 -4
- data/vendor/assets/javascripts/angular-resource.js +1 -1
- data/vendor/assets/javascripts/angular-sanitize.js +4 -1
- data/vendor/assets/javascripts/angular-scenario.js +171 -97
- data/vendor/assets/javascripts/angular.js +171 -97
- data/vendor/assets/javascripts/jstd-scenario-adapter.js +1 -1
- metadata +1 -1
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.0.
|
2
|
+
* @license AngularJS v1.0.2
|
3
3
|
* (c) 2010-2012 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -200,7 +200,7 @@ function setupModuleLoader(window) {
|
|
200
200
|
* @param {Function} directiveFactory Factory function for creating new instance of
|
201
201
|
* directives.
|
202
202
|
* @description
|
203
|
-
* See {@link ng.$compileProvider
|
203
|
+
* See {@link ng.$compileProvider#directive $compileProvider.directive()}.
|
204
204
|
*/
|
205
205
|
directive: invokeLater('$compileProvider', 'directive'),
|
206
206
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
/**
|
3
|
-
* @license AngularJS v1.0.
|
3
|
+
* @license AngularJS v1.0.2
|
4
4
|
* (c) 2010-2012 Google, Inc. http://angularjs.org
|
5
5
|
* License: MIT
|
6
6
|
*
|
@@ -1591,9 +1591,29 @@ window.jasmine && (function(window) {
|
|
1591
1591
|
|
1592
1592
|
afterEach(function() {
|
1593
1593
|
var spec = getCurrentSpec();
|
1594
|
+
var injector = spec.$injector;
|
1595
|
+
|
1594
1596
|
spec.$injector = null;
|
1595
1597
|
spec.$modules = null;
|
1598
|
+
|
1599
|
+
if (injector) {
|
1600
|
+
injector.get('$rootElement').unbind();
|
1601
|
+
injector.get('$browser').pollFns.length = 0;
|
1602
|
+
}
|
1603
|
+
|
1596
1604
|
angular.mock.clearDataCache();
|
1605
|
+
|
1606
|
+
// clean up jquery's fragment cache
|
1607
|
+
angular.forEach(angular.element.fragments, function(val, key) {
|
1608
|
+
delete angular.element.fragments[key];
|
1609
|
+
});
|
1610
|
+
|
1611
|
+
MockXhr.$$lastInstance = null;
|
1612
|
+
|
1613
|
+
angular.forEach(angular.callbacks, function(val, key) {
|
1614
|
+
delete angular.callbacks[key];
|
1615
|
+
});
|
1616
|
+
angular.callbacks.counter = 0;
|
1597
1617
|
});
|
1598
1618
|
|
1599
1619
|
function getCurrentSpec() {
|
@@ -1694,7 +1714,7 @@ window.jasmine && (function(window) {
|
|
1694
1714
|
*/
|
1695
1715
|
window.inject = angular.mock.inject = function() {
|
1696
1716
|
var blockFns = Array.prototype.slice.call(arguments, 0);
|
1697
|
-
var
|
1717
|
+
var errorForStack = new Error('Declaration Location');
|
1698
1718
|
return isSpecRunning() ? workFn() : workFn;
|
1699
1719
|
/////////////////////
|
1700
1720
|
function workFn() {
|
@@ -1710,10 +1730,12 @@ window.jasmine && (function(window) {
|
|
1710
1730
|
try {
|
1711
1731
|
injector.invoke(blockFns[i] || angular.noop, this);
|
1712
1732
|
} catch (e) {
|
1713
|
-
if(e.stack) e.stack += '\n' + stack;
|
1733
|
+
if(e.stack) e.stack += '\n' + errorForStack.stack;
|
1714
1734
|
throw e;
|
1735
|
+
} finally {
|
1736
|
+
errorForStack = null;
|
1715
1737
|
}
|
1716
1738
|
}
|
1717
1739
|
}
|
1718
|
-
}
|
1740
|
+
};
|
1719
1741
|
})(window);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.0.
|
2
|
+
* @license AngularJS v1.0.2
|
3
3
|
* (c) 2010-2012 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -434,6 +434,9 @@ angular.module('ngSanitize').directive('ngBindHtml', ['$sanitize', function($san
|
|
434
434
|
* @param {string} text Input text.
|
435
435
|
* @returns {string} Html-linkified text.
|
436
436
|
*
|
437
|
+
* @usage
|
438
|
+
<span ng-bind-html="linky_expression | linky"></span>
|
439
|
+
*
|
437
440
|
* @example
|
438
441
|
<doc:example module="ngSanitize">
|
439
442
|
<doc:source>
|
@@ -9404,7 +9404,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
|
|
9404
9404
|
|
9405
9405
|
})( window );
|
9406
9406
|
/**
|
9407
|
-
* @license AngularJS v1.0.
|
9407
|
+
* @license AngularJS v1.0.2
|
9408
9408
|
* (c) 2010-2012 Google, Inc. http://angularjs.org
|
9409
9409
|
* License: MIT
|
9410
9410
|
*/
|
@@ -10583,7 +10583,7 @@ function setupModuleLoader(window) {
|
|
10583
10583
|
* @param {Function} directiveFactory Factory function for creating new instance of
|
10584
10584
|
* directives.
|
10585
10585
|
* @description
|
10586
|
-
* See {@link ng.$compileProvider
|
10586
|
+
* See {@link ng.$compileProvider#directive $compileProvider.directive()}.
|
10587
10587
|
*/
|
10588
10588
|
directive: invokeLater('$compileProvider', 'directive'),
|
10589
10589
|
|
@@ -10652,11 +10652,11 @@ function setupModuleLoader(window) {
|
|
10652
10652
|
* - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
|
10653
10653
|
*/
|
10654
10654
|
var version = {
|
10655
|
-
full: '1.0.
|
10655
|
+
full: '1.0.2', // all of these placeholder strings will be replaced by rake's
|
10656
10656
|
major: 1, // compile task
|
10657
10657
|
minor: 0,
|
10658
|
-
dot:
|
10659
|
-
codeName: '
|
10658
|
+
dot: 2,
|
10659
|
+
codeName: 'debilitating-awesomeness'
|
10660
10660
|
};
|
10661
10661
|
|
10662
10662
|
|
@@ -10934,7 +10934,7 @@ function JQLite(element) {
|
|
10934
10934
|
var div = document.createElement('div');
|
10935
10935
|
// Read about the NoScope elements here:
|
10936
10936
|
// http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx
|
10937
|
-
div.innerHTML = '<div
|
10937
|
+
div.innerHTML = '<div> </div>' + element; // IE insanity to make NoScope elements work!
|
10938
10938
|
div.removeChild(div.firstChild); // remove the superfluous div
|
10939
10939
|
JQLiteAddNodes(this, div.childNodes);
|
10940
10940
|
this.remove(); // detach the elements from the temporary DOM div.
|
@@ -12846,7 +12846,7 @@ var NON_ASSIGNABLE_MODEL_EXPRESSION = 'Non-assignable model expression: ';
|
|
12846
12846
|
* can then be used to link {@link ng.$rootScope.Scope scope} and the template together.
|
12847
12847
|
*
|
12848
12848
|
* The compilation is a process of walking the DOM tree and trying to match DOM elements to
|
12849
|
-
* {@link ng.$compileProvider
|
12849
|
+
* {@link ng.$compileProvider#directive directives}. For each match it
|
12850
12850
|
* executes corresponding template function and collects the
|
12851
12851
|
* instance functions into a single template function which is then returned.
|
12852
12852
|
*
|
@@ -12964,20 +12964,6 @@ var NON_ASSIGNABLE_MODEL_EXPRESSION = 'Non-assignable model expression: ';
|
|
12964
12964
|
*
|
12965
12965
|
* @description
|
12966
12966
|
*/
|
12967
|
-
|
12968
|
-
/**
|
12969
|
-
* @ngdoc function
|
12970
|
-
* @name ng.$compileProvider#directive
|
12971
|
-
* @methodOf ng.$compileProvider
|
12972
|
-
* @function
|
12973
|
-
*
|
12974
|
-
* @description
|
12975
|
-
* Register a new directive with compiler
|
12976
|
-
*
|
12977
|
-
* @param {string} name name of the directive.
|
12978
|
-
* @param {function} directiveFactory An injectable directive factory function.
|
12979
|
-
* @returns {ng.$compileProvider} Self for chaining.
|
12980
|
-
*/
|
12981
12967
|
$CompileProvider.$inject = ['$provide'];
|
12982
12968
|
function $CompileProvider($provide) {
|
12983
12969
|
var hasDirectives = {},
|
@@ -12989,17 +12975,18 @@ function $CompileProvider($provide) {
|
|
12989
12975
|
|
12990
12976
|
/**
|
12991
12977
|
* @ngdoc function
|
12992
|
-
* @name ng.$compileProvider
|
12978
|
+
* @name ng.$compileProvider#directive
|
12993
12979
|
* @methodOf ng.$compileProvider
|
12994
12980
|
* @function
|
12995
12981
|
*
|
12996
12982
|
* @description
|
12997
|
-
* Register directives with the compiler.
|
12983
|
+
* Register a new directives with the compiler.
|
12998
12984
|
*
|
12999
12985
|
* @param {string} name Name of the directive in camel-case. (ie <code>ngBind</code> which will match as
|
13000
12986
|
* <code>ng-bind</code>).
|
13001
12987
|
* @param {function} directiveFactory An injectable directive factroy function. See {@link guide/directive} for more
|
13002
12988
|
* info.
|
12989
|
+
* @returns {ng.$compileProvider} Self for chaining.
|
13003
12990
|
*/
|
13004
12991
|
this.directive = function registerDirective(name, directiveFactory) {
|
13005
12992
|
if (isString(name)) {
|
@@ -13125,6 +13112,15 @@ function $CompileProvider($provide) {
|
|
13125
13112
|
}
|
13126
13113
|
};
|
13127
13114
|
|
13115
|
+
var startSymbol = $interpolate.startSymbol(),
|
13116
|
+
endSymbol = $interpolate.endSymbol(),
|
13117
|
+
denormalizeTemplate = (startSymbol == '{{' || endSymbol == '}}')
|
13118
|
+
? identity
|
13119
|
+
: function denormalizeTemplate(template) {
|
13120
|
+
return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
|
13121
|
+
};
|
13122
|
+
|
13123
|
+
|
13128
13124
|
return compile;
|
13129
13125
|
|
13130
13126
|
//================================
|
@@ -13138,7 +13134,7 @@ function $CompileProvider($provide) {
|
|
13138
13134
|
// not be able to attach scope data to them, so we will wrap them in <span>
|
13139
13135
|
forEach($compileNode, function(node, index){
|
13140
13136
|
if (node.nodeType == 3 /* text node */) {
|
13141
|
-
$compileNode[index] = jqLite(node).wrap('<span>').parent()[0];
|
13137
|
+
$compileNode[index] = jqLite(node).wrap('<span></span>').parent()[0];
|
13142
13138
|
}
|
13143
13139
|
});
|
13144
13140
|
var compositeLinkFn = compileNodes($compileNode, transcludeFn, $compileNode, maxPriority);
|
@@ -13404,14 +13400,17 @@ function $CompileProvider($provide) {
|
|
13404
13400
|
}
|
13405
13401
|
}
|
13406
13402
|
|
13407
|
-
if (directiveValue = directive.template) {
|
13403
|
+
if ((directiveValue = directive.template)) {
|
13408
13404
|
assertNoDuplicate('template', templateDirective, directive, $compileNode);
|
13409
13405
|
templateDirective = directive;
|
13410
|
-
|
13411
|
-
$template = jqLite('<div>' + trim(directiveValue) + '</div>').contents();
|
13412
|
-
compileNode = $template[0];
|
13406
|
+
directiveValue = denormalizeTemplate(directiveValue);
|
13413
13407
|
|
13414
13408
|
if (directive.replace) {
|
13409
|
+
$template = jqLite('<div>' +
|
13410
|
+
trim(directiveValue) +
|
13411
|
+
'</div>').contents();
|
13412
|
+
compileNode = $template[0];
|
13413
|
+
|
13415
13414
|
if ($template.length != 1 || compileNode.nodeType !== 1) {
|
13416
13415
|
throw new Error(MULTI_ROOT_TEMPLATE_ERROR + directiveValue);
|
13417
13416
|
}
|
@@ -13724,6 +13723,8 @@ function $CompileProvider($provide) {
|
|
13724
13723
|
success(function(content) {
|
13725
13724
|
var compileNode, tempTemplateAttrs, $template;
|
13726
13725
|
|
13726
|
+
content = denormalizeTemplate(content);
|
13727
|
+
|
13727
13728
|
if (replace) {
|
13728
13729
|
$template = jqLite('<div>' + trim(content) + '</div>').contents();
|
13729
13730
|
compileNode = $template[0];
|
@@ -14068,13 +14069,13 @@ function $ExceptionHandlerProvider() {
|
|
14068
14069
|
}
|
14069
14070
|
|
14070
14071
|
/**
|
14071
|
-
* @ngdoc
|
14072
|
+
* @ngdoc object
|
14072
14073
|
* @name ng.$interpolateProvider
|
14073
14074
|
* @function
|
14074
14075
|
*
|
14075
14076
|
* @description
|
14076
14077
|
*
|
14077
|
-
* Used for configuring the interpolation markup.
|
14078
|
+
* Used for configuring the interpolation markup. Defaults to `{{` and `}}`.
|
14078
14079
|
*/
|
14079
14080
|
function $InterpolateProvider() {
|
14080
14081
|
var startSymbol = '{{';
|
@@ -14087,7 +14088,8 @@ function $InterpolateProvider() {
|
|
14087
14088
|
* @description
|
14088
14089
|
* Symbol to denote start of expression in the interpolated string. Defaults to `{{`.
|
14089
14090
|
*
|
14090
|
-
* @
|
14091
|
+
* @param {string=} value new value to set the starting symbol to.
|
14092
|
+
* @returns {string|self} Returns the symbol when used as getter and self if used as setter.
|
14091
14093
|
*/
|
14092
14094
|
this.startSymbol = function(value){
|
14093
14095
|
if (value) {
|
@@ -14105,14 +14107,15 @@ function $InterpolateProvider() {
|
|
14105
14107
|
* @description
|
14106
14108
|
* Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
|
14107
14109
|
*
|
14108
|
-
* @
|
14110
|
+
* @param {string=} value new value to set the ending symbol to.
|
14111
|
+
* @returns {string|self} Returns the symbol when used as getter and self if used as setter.
|
14109
14112
|
*/
|
14110
14113
|
this.endSymbol = function(value){
|
14111
14114
|
if (value) {
|
14112
14115
|
endSymbol = value;
|
14113
14116
|
return this;
|
14114
14117
|
} else {
|
14115
|
-
return
|
14118
|
+
return endSymbol;
|
14116
14119
|
}
|
14117
14120
|
};
|
14118
14121
|
|
@@ -14154,7 +14157,7 @@ function $InterpolateProvider() {
|
|
14154
14157
|
* against.
|
14155
14158
|
*
|
14156
14159
|
*/
|
14157
|
-
|
14160
|
+
function $interpolate(text, mustHaveExpression) {
|
14158
14161
|
var startIndex,
|
14159
14162
|
endIndex,
|
14160
14163
|
index = 0,
|
@@ -14206,7 +14209,43 @@ function $InterpolateProvider() {
|
|
14206
14209
|
fn.parts = parts;
|
14207
14210
|
return fn;
|
14208
14211
|
}
|
14209
|
-
}
|
14212
|
+
}
|
14213
|
+
|
14214
|
+
|
14215
|
+
/**
|
14216
|
+
* @ngdoc method
|
14217
|
+
* @name ng.$interpolate#startSymbol
|
14218
|
+
* @methodOf ng.$interpolate
|
14219
|
+
* @description
|
14220
|
+
* Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.
|
14221
|
+
*
|
14222
|
+
* Use {@link ng.$interpolateProvider#startSymbol $interpolateProvider#startSymbol} to change
|
14223
|
+
* the symbol.
|
14224
|
+
*
|
14225
|
+
* @returns {string} start symbol.
|
14226
|
+
*/
|
14227
|
+
$interpolate.startSymbol = function() {
|
14228
|
+
return startSymbol;
|
14229
|
+
}
|
14230
|
+
|
14231
|
+
|
14232
|
+
/**
|
14233
|
+
* @ngdoc method
|
14234
|
+
* @name ng.$interpolate#endSymbol
|
14235
|
+
* @methodOf ng.$interpolate
|
14236
|
+
* @description
|
14237
|
+
* Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
|
14238
|
+
*
|
14239
|
+
* Use {@link ng.$interpolateProvider#endSymbol $interpolateProvider#endSymbol} to change
|
14240
|
+
* the symbol.
|
14241
|
+
*
|
14242
|
+
* @returns {string} start symbol.
|
14243
|
+
*/
|
14244
|
+
$interpolate.endSymbol = function() {
|
14245
|
+
return endSymbol;
|
14246
|
+
}
|
14247
|
+
|
14248
|
+
return $interpolate;
|
14210
14249
|
}];
|
14211
14250
|
}
|
14212
14251
|
|
@@ -14838,27 +14877,25 @@ function $LocationProvider(){
|
|
14838
14877
|
* The main purpose of this service is to simplify debugging and troubleshooting.
|
14839
14878
|
*
|
14840
14879
|
* @example
|
14841
|
-
|
14842
|
-
|
14843
|
-
|
14844
|
-
|
14845
|
-
|
14846
|
-
|
14847
|
-
|
14848
|
-
|
14849
|
-
|
14850
|
-
|
14851
|
-
|
14852
|
-
|
14853
|
-
|
14854
|
-
|
14855
|
-
|
14856
|
-
|
14857
|
-
|
14858
|
-
|
14859
|
-
|
14860
|
-
</doc:scenario>
|
14861
|
-
</doc:example>
|
14880
|
+
<example>
|
14881
|
+
<file name="script.js">
|
14882
|
+
function LogCtrl($scope, $log) {
|
14883
|
+
$scope.$log = $log;
|
14884
|
+
$scope.message = 'Hello World!';
|
14885
|
+
}
|
14886
|
+
</file>
|
14887
|
+
<file name="index.html">
|
14888
|
+
<div ng-controller="LogCtrl">
|
14889
|
+
<p>Reload this page with open console, enter text and hit the log button...</p>
|
14890
|
+
Message:
|
14891
|
+
<input type="text" ng-model="message"/>
|
14892
|
+
<button ng-click="$log.log(message)">log</button>
|
14893
|
+
<button ng-click="$log.warn(message)">warn</button>
|
14894
|
+
<button ng-click="$log.info(message)">info</button>
|
14895
|
+
<button ng-click="$log.error(message)">error</button>
|
14896
|
+
</div>
|
14897
|
+
</file>
|
14898
|
+
</example>
|
14862
14899
|
*/
|
14863
14900
|
|
14864
14901
|
function $LogProvider(){
|
@@ -16215,8 +16252,9 @@ function $RouteProvider(){
|
|
16215
16252
|
*
|
16216
16253
|
* Object properties:
|
16217
16254
|
*
|
16218
|
-
* - `controller` – `{function()=}` – Controller fn that should be associated with newly
|
16219
|
-
* created scope.
|
16255
|
+
* - `controller` – `{(string|function()=}` – Controller fn that should be associated with newly
|
16256
|
+
* created scope or the name of a {@link angular.Module#controller registered controller}
|
16257
|
+
* if passed as a string.
|
16220
16258
|
* - `template` – `{string=}` – html template as a string that should be used by
|
16221
16259
|
* {@link ng.directive:ngView ngView} or
|
16222
16260
|
* {@link ng.directive:ngInclude ngInclude} directives.
|
@@ -16226,7 +16264,7 @@ function $RouteProvider(){
|
|
16226
16264
|
* - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should
|
16227
16265
|
* be injected into the controller. If any of these dependencies are promises, they will be
|
16228
16266
|
* resolved and converted to a value before the controller is instantiated and the
|
16229
|
-
* `$
|
16267
|
+
* `$afterRouteChange` event is fired. The map object is:
|
16230
16268
|
*
|
16231
16269
|
* - `key` – `{string}`: a name of a dependency to be injected into the controller.
|
16232
16270
|
* - `factory` - `{string|function}`: If `string` then it is an alias for a service.
|
@@ -16992,9 +17030,9 @@ function $RootScopeProvider(){
|
|
16992
17030
|
*
|
16993
17031
|
* Usually you don't call `$digest()` directly in
|
16994
17032
|
* {@link ng.directive:ngController controllers} or in
|
16995
|
-
* {@link ng.$compileProvider
|
17033
|
+
* {@link ng.$compileProvider#directive directives}.
|
16996
17034
|
* Instead a call to {@link ng.$rootScope.Scope#$apply $apply()} (typically from within a
|
16997
|
-
* {@link ng.$compileProvider
|
17035
|
+
* {@link ng.$compileProvider#directive directives}) will force a `$digest()`.
|
16998
17036
|
*
|
16999
17037
|
* If you want to be notified whenever `$digest()` is called,
|
17000
17038
|
* you can register a `watchExpression` function with {@link ng.$rootScope.Scope#$watch $watch()}
|
@@ -17280,8 +17318,8 @@ function $RootScopeProvider(){
|
|
17280
17318
|
* @param {function(event)} listener Function to call when the event is emitted.
|
17281
17319
|
* @returns {function()} Returns a deregistration function for this listener.
|
17282
17320
|
*
|
17283
|
-
* The event listener function format is: `function(event)`. The `event` object
|
17284
|
-
* listener has the following attributes
|
17321
|
+
* The event listener function format is: `function(event, args...)`. The `event` object
|
17322
|
+
* passed into the listener has the following attributes:
|
17285
17323
|
*
|
17286
17324
|
* - `targetScope` - {Scope}: the scope on which the event was `$emit`-ed or `$broadcast`-ed.
|
17287
17325
|
* - `currentScope` - {Scope}: the current scope which is handling the event.
|
@@ -19510,7 +19548,12 @@ function ngDirective(directive) {
|
|
19510
19548
|
return valueFn(directive);
|
19511
19549
|
}
|
19512
19550
|
|
19513
|
-
|
19551
|
+
/**
|
19552
|
+
* @ngdoc directive
|
19553
|
+
* @name ng.directive:a
|
19554
|
+
* @restrict E
|
19555
|
+
*
|
19556
|
+
* @description
|
19514
19557
|
* Modifies the default behavior of html A tag, so that the default action is prevented when href
|
19515
19558
|
* attribute is empty.
|
19516
19559
|
*
|
@@ -20078,41 +20121,65 @@ function FormController(element, attrs) {
|
|
20078
20121
|
</doc:scenario>
|
20079
20122
|
</doc:example>
|
20080
20123
|
*/
|
20081
|
-
var
|
20082
|
-
|
20083
|
-
|
20084
|
-
|
20085
|
-
|
20086
|
-
|
20087
|
-
|
20088
|
-
|
20089
|
-
|
20090
|
-
|
20091
|
-
|
20092
|
-
|
20124
|
+
var formDirectiveFactory = function(isNgForm) {
|
20125
|
+
return ['$timeout', function($timeout) {
|
20126
|
+
var formDirective = {
|
20127
|
+
name: 'form',
|
20128
|
+
restrict: 'E',
|
20129
|
+
controller: FormController,
|
20130
|
+
compile: function() {
|
20131
|
+
return {
|
20132
|
+
pre: function(scope, formElement, attr, controller) {
|
20133
|
+
if (!attr.action) {
|
20134
|
+
// we can't use jq events because if a form is destroyed during submission the default
|
20135
|
+
// action is not prevented. see #1238
|
20136
|
+
//
|
20137
|
+
// IE 9 is not affected because it doesn't fire a submit event and try to do a full
|
20138
|
+
// page reload if the form was destroyed by submission of the form via a click handler
|
20139
|
+
// on a button in the form. Looks like an IE9 specific bug.
|
20140
|
+
var preventDefaultListener = function(event) {
|
20141
|
+
event.preventDefault
|
20142
|
+
? event.preventDefault()
|
20143
|
+
: event.returnValue = false; // IE
|
20144
|
+
};
|
20093
20145
|
|
20094
|
-
|
20095
|
-
|
20146
|
+
addEventListenerFn(formElement[0], 'submit', preventDefaultListener);
|
20147
|
+
|
20148
|
+
// unregister the preventDefault listener so that we don't not leak memory but in a
|
20149
|
+
// way that will achieve the prevention of the default action.
|
20150
|
+
formElement.bind('$destroy', function() {
|
20151
|
+
$timeout(function() {
|
20152
|
+
removeEventListenerFn(formElement[0], 'submit', preventDefaultListener);
|
20153
|
+
}, 0, false);
|
20154
|
+
});
|
20155
|
+
}
|
20156
|
+
|
20157
|
+
var parentFormCtrl = formElement.parent().controller('form'),
|
20158
|
+
alias = attr.name || attr.ngForm;
|
20096
20159
|
|
20097
|
-
if (alias) {
|
20098
|
-
scope[alias] = controller;
|
20099
|
-
}
|
20100
|
-
if (parentFormCtrl) {
|
20101
|
-
formElement.bind('$destroy', function() {
|
20102
|
-
parentFormCtrl.$removeControl(controller);
|
20103
20160
|
if (alias) {
|
20104
|
-
scope[alias] =
|
20161
|
+
scope[alias] = controller;
|
20105
20162
|
}
|
20106
|
-
|
20107
|
-
|
20108
|
-
|
20163
|
+
if (parentFormCtrl) {
|
20164
|
+
formElement.bind('$destroy', function() {
|
20165
|
+
parentFormCtrl.$removeControl(controller);
|
20166
|
+
if (alias) {
|
20167
|
+
scope[alias] = undefined;
|
20168
|
+
}
|
20169
|
+
extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards
|
20170
|
+
});
|
20171
|
+
}
|
20172
|
+
}
|
20173
|
+
};
|
20109
20174
|
}
|
20110
20175
|
};
|
20111
|
-
|
20176
|
+
|
20177
|
+
return isNgForm ? extend(copy(formDirective), {restrict: 'EAC'}) : formDirective;
|
20178
|
+
}];
|
20112
20179
|
};
|
20113
20180
|
|
20114
|
-
var formDirective =
|
20115
|
-
var ngFormDirective =
|
20181
|
+
var formDirective = formDirectiveFactory();
|
20182
|
+
var ngFormDirective = formDirectiveFactory(true);
|
20116
20183
|
|
20117
20184
|
var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
|
20118
20185
|
var EMAIL_REGEXP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/;
|
@@ -21333,7 +21400,7 @@ var ngListDirective = function() {
|
|
21333
21400
|
|
21334
21401
|
ctrl.$parsers.push(parse);
|
21335
21402
|
ctrl.$formatters.push(function(value) {
|
21336
|
-
if (isArray(value)
|
21403
|
+
if (isArray(value)) {
|
21337
21404
|
return value.join(', ');
|
21338
21405
|
}
|
21339
21406
|
|
@@ -22450,11 +22517,14 @@ var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interp
|
|
22450
22517
|
whenExp = element.attr(attr.$attr.when), // this is because we have {{}} in attrs
|
22451
22518
|
offset = attr.offset || 0,
|
22452
22519
|
whens = scope.$eval(whenExp),
|
22453
|
-
whensExpFns = {}
|
22520
|
+
whensExpFns = {},
|
22521
|
+
startSymbol = $interpolate.startSymbol(),
|
22522
|
+
endSymbol = $interpolate.endSymbol();
|
22454
22523
|
|
22455
22524
|
forEach(whens, function(expression, key) {
|
22456
22525
|
whensExpFns[key] =
|
22457
|
-
$interpolate(expression.replace(BRACE,
|
22526
|
+
$interpolate(expression.replace(BRACE, startSymbol + numberExp + '-' +
|
22527
|
+
offset + endSymbol));
|
22458
22528
|
});
|
22459
22529
|
|
22460
22530
|
scope.$watch(function() {
|
@@ -23678,7 +23748,6 @@ var optionDirective = ['$interpolate', function($interpolate) {
|
|
23678
23748
|
return {
|
23679
23749
|
restrict: 'E',
|
23680
23750
|
priority: 100,
|
23681
|
-
require: '^select',
|
23682
23751
|
compile: function(element, attr) {
|
23683
23752
|
if (isUndefined(attr.value)) {
|
23684
23753
|
var interpolateFn = $interpolate(element.text(), true);
|
@@ -23687,8 +23756,13 @@ var optionDirective = ['$interpolate', function($interpolate) {
|
|
23687
23756
|
}
|
23688
23757
|
}
|
23689
23758
|
|
23690
|
-
return function (scope, element, attr
|
23691
|
-
|
23759
|
+
return function (scope, element, attr) {
|
23760
|
+
var selectCtrlName = '$selectController',
|
23761
|
+
parent = element.parent(),
|
23762
|
+
selectCtrl = parent.data(selectCtrlName) ||
|
23763
|
+
parent.parent().data(selectCtrlName); // in case we are in optgroup
|
23764
|
+
|
23765
|
+
if (selectCtrl && selectCtrl.databound) {
|
23692
23766
|
// For some reason Opera defaults to true and if not overridden this messes up the repeater.
|
23693
23767
|
// We don't want the view to drive the initialization of the model anyway.
|
23694
23768
|
element.prop('selected', false);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.0.
|
2
|
+
* @license AngularJS v1.0.2
|
3
3
|
* (c) 2010-2012 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -1178,7 +1178,7 @@ function setupModuleLoader(window) {
|
|
1178
1178
|
* @param {Function} directiveFactory Factory function for creating new instance of
|
1179
1179
|
* directives.
|
1180
1180
|
* @description
|
1181
|
-
* See {@link ng.$compileProvider
|
1181
|
+
* See {@link ng.$compileProvider#directive $compileProvider.directive()}.
|
1182
1182
|
*/
|
1183
1183
|
directive: invokeLater('$compileProvider', 'directive'),
|
1184
1184
|
|
@@ -1247,11 +1247,11 @@ function setupModuleLoader(window) {
|
|
1247
1247
|
* - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
|
1248
1248
|
*/
|
1249
1249
|
var version = {
|
1250
|
-
full: '1.0.
|
1250
|
+
full: '1.0.2', // all of these placeholder strings will be replaced by rake's
|
1251
1251
|
major: 1, // compile task
|
1252
1252
|
minor: 0,
|
1253
|
-
dot:
|
1254
|
-
codeName: '
|
1253
|
+
dot: 2,
|
1254
|
+
codeName: 'debilitating-awesomeness'
|
1255
1255
|
};
|
1256
1256
|
|
1257
1257
|
|
@@ -1529,7 +1529,7 @@ function JQLite(element) {
|
|
1529
1529
|
var div = document.createElement('div');
|
1530
1530
|
// Read about the NoScope elements here:
|
1531
1531
|
// http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx
|
1532
|
-
div.innerHTML = '<div
|
1532
|
+
div.innerHTML = '<div> </div>' + element; // IE insanity to make NoScope elements work!
|
1533
1533
|
div.removeChild(div.firstChild); // remove the superfluous div
|
1534
1534
|
JQLiteAddNodes(this, div.childNodes);
|
1535
1535
|
this.remove(); // detach the elements from the temporary DOM div.
|
@@ -3441,7 +3441,7 @@ var NON_ASSIGNABLE_MODEL_EXPRESSION = 'Non-assignable model expression: ';
|
|
3441
3441
|
* can then be used to link {@link ng.$rootScope.Scope scope} and the template together.
|
3442
3442
|
*
|
3443
3443
|
* The compilation is a process of walking the DOM tree and trying to match DOM elements to
|
3444
|
-
* {@link ng.$compileProvider
|
3444
|
+
* {@link ng.$compileProvider#directive directives}. For each match it
|
3445
3445
|
* executes corresponding template function and collects the
|
3446
3446
|
* instance functions into a single template function which is then returned.
|
3447
3447
|
*
|
@@ -3559,20 +3559,6 @@ var NON_ASSIGNABLE_MODEL_EXPRESSION = 'Non-assignable model expression: ';
|
|
3559
3559
|
*
|
3560
3560
|
* @description
|
3561
3561
|
*/
|
3562
|
-
|
3563
|
-
/**
|
3564
|
-
* @ngdoc function
|
3565
|
-
* @name ng.$compileProvider#directive
|
3566
|
-
* @methodOf ng.$compileProvider
|
3567
|
-
* @function
|
3568
|
-
*
|
3569
|
-
* @description
|
3570
|
-
* Register a new directive with compiler
|
3571
|
-
*
|
3572
|
-
* @param {string} name name of the directive.
|
3573
|
-
* @param {function} directiveFactory An injectable directive factory function.
|
3574
|
-
* @returns {ng.$compileProvider} Self for chaining.
|
3575
|
-
*/
|
3576
3562
|
$CompileProvider.$inject = ['$provide'];
|
3577
3563
|
function $CompileProvider($provide) {
|
3578
3564
|
var hasDirectives = {},
|
@@ -3584,17 +3570,18 @@ function $CompileProvider($provide) {
|
|
3584
3570
|
|
3585
3571
|
/**
|
3586
3572
|
* @ngdoc function
|
3587
|
-
* @name ng.$compileProvider
|
3573
|
+
* @name ng.$compileProvider#directive
|
3588
3574
|
* @methodOf ng.$compileProvider
|
3589
3575
|
* @function
|
3590
3576
|
*
|
3591
3577
|
* @description
|
3592
|
-
* Register directives with the compiler.
|
3578
|
+
* Register a new directives with the compiler.
|
3593
3579
|
*
|
3594
3580
|
* @param {string} name Name of the directive in camel-case. (ie <code>ngBind</code> which will match as
|
3595
3581
|
* <code>ng-bind</code>).
|
3596
3582
|
* @param {function} directiveFactory An injectable directive factroy function. See {@link guide/directive} for more
|
3597
3583
|
* info.
|
3584
|
+
* @returns {ng.$compileProvider} Self for chaining.
|
3598
3585
|
*/
|
3599
3586
|
this.directive = function registerDirective(name, directiveFactory) {
|
3600
3587
|
if (isString(name)) {
|
@@ -3720,6 +3707,15 @@ function $CompileProvider($provide) {
|
|
3720
3707
|
}
|
3721
3708
|
};
|
3722
3709
|
|
3710
|
+
var startSymbol = $interpolate.startSymbol(),
|
3711
|
+
endSymbol = $interpolate.endSymbol(),
|
3712
|
+
denormalizeTemplate = (startSymbol == '{{' || endSymbol == '}}')
|
3713
|
+
? identity
|
3714
|
+
: function denormalizeTemplate(template) {
|
3715
|
+
return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
|
3716
|
+
};
|
3717
|
+
|
3718
|
+
|
3723
3719
|
return compile;
|
3724
3720
|
|
3725
3721
|
//================================
|
@@ -3733,7 +3729,7 @@ function $CompileProvider($provide) {
|
|
3733
3729
|
// not be able to attach scope data to them, so we will wrap them in <span>
|
3734
3730
|
forEach($compileNode, function(node, index){
|
3735
3731
|
if (node.nodeType == 3 /* text node */) {
|
3736
|
-
$compileNode[index] = jqLite(node).wrap('<span>').parent()[0];
|
3732
|
+
$compileNode[index] = jqLite(node).wrap('<span></span>').parent()[0];
|
3737
3733
|
}
|
3738
3734
|
});
|
3739
3735
|
var compositeLinkFn = compileNodes($compileNode, transcludeFn, $compileNode, maxPriority);
|
@@ -3999,14 +3995,17 @@ function $CompileProvider($provide) {
|
|
3999
3995
|
}
|
4000
3996
|
}
|
4001
3997
|
|
4002
|
-
if (directiveValue = directive.template) {
|
3998
|
+
if ((directiveValue = directive.template)) {
|
4003
3999
|
assertNoDuplicate('template', templateDirective, directive, $compileNode);
|
4004
4000
|
templateDirective = directive;
|
4005
|
-
|
4006
|
-
$template = jqLite('<div>' + trim(directiveValue) + '</div>').contents();
|
4007
|
-
compileNode = $template[0];
|
4001
|
+
directiveValue = denormalizeTemplate(directiveValue);
|
4008
4002
|
|
4009
4003
|
if (directive.replace) {
|
4004
|
+
$template = jqLite('<div>' +
|
4005
|
+
trim(directiveValue) +
|
4006
|
+
'</div>').contents();
|
4007
|
+
compileNode = $template[0];
|
4008
|
+
|
4010
4009
|
if ($template.length != 1 || compileNode.nodeType !== 1) {
|
4011
4010
|
throw new Error(MULTI_ROOT_TEMPLATE_ERROR + directiveValue);
|
4012
4011
|
}
|
@@ -4319,6 +4318,8 @@ function $CompileProvider($provide) {
|
|
4319
4318
|
success(function(content) {
|
4320
4319
|
var compileNode, tempTemplateAttrs, $template;
|
4321
4320
|
|
4321
|
+
content = denormalizeTemplate(content);
|
4322
|
+
|
4322
4323
|
if (replace) {
|
4323
4324
|
$template = jqLite('<div>' + trim(content) + '</div>').contents();
|
4324
4325
|
compileNode = $template[0];
|
@@ -4663,13 +4664,13 @@ function $ExceptionHandlerProvider() {
|
|
4663
4664
|
}
|
4664
4665
|
|
4665
4666
|
/**
|
4666
|
-
* @ngdoc
|
4667
|
+
* @ngdoc object
|
4667
4668
|
* @name ng.$interpolateProvider
|
4668
4669
|
* @function
|
4669
4670
|
*
|
4670
4671
|
* @description
|
4671
4672
|
*
|
4672
|
-
* Used for configuring the interpolation markup.
|
4673
|
+
* Used for configuring the interpolation markup. Defaults to `{{` and `}}`.
|
4673
4674
|
*/
|
4674
4675
|
function $InterpolateProvider() {
|
4675
4676
|
var startSymbol = '{{';
|
@@ -4682,7 +4683,8 @@ function $InterpolateProvider() {
|
|
4682
4683
|
* @description
|
4683
4684
|
* Symbol to denote start of expression in the interpolated string. Defaults to `{{`.
|
4684
4685
|
*
|
4685
|
-
* @
|
4686
|
+
* @param {string=} value new value to set the starting symbol to.
|
4687
|
+
* @returns {string|self} Returns the symbol when used as getter and self if used as setter.
|
4686
4688
|
*/
|
4687
4689
|
this.startSymbol = function(value){
|
4688
4690
|
if (value) {
|
@@ -4700,14 +4702,15 @@ function $InterpolateProvider() {
|
|
4700
4702
|
* @description
|
4701
4703
|
* Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
|
4702
4704
|
*
|
4703
|
-
* @
|
4705
|
+
* @param {string=} value new value to set the ending symbol to.
|
4706
|
+
* @returns {string|self} Returns the symbol when used as getter and self if used as setter.
|
4704
4707
|
*/
|
4705
4708
|
this.endSymbol = function(value){
|
4706
4709
|
if (value) {
|
4707
4710
|
endSymbol = value;
|
4708
4711
|
return this;
|
4709
4712
|
} else {
|
4710
|
-
return
|
4713
|
+
return endSymbol;
|
4711
4714
|
}
|
4712
4715
|
};
|
4713
4716
|
|
@@ -4749,7 +4752,7 @@ function $InterpolateProvider() {
|
|
4749
4752
|
* against.
|
4750
4753
|
*
|
4751
4754
|
*/
|
4752
|
-
|
4755
|
+
function $interpolate(text, mustHaveExpression) {
|
4753
4756
|
var startIndex,
|
4754
4757
|
endIndex,
|
4755
4758
|
index = 0,
|
@@ -4801,7 +4804,43 @@ function $InterpolateProvider() {
|
|
4801
4804
|
fn.parts = parts;
|
4802
4805
|
return fn;
|
4803
4806
|
}
|
4804
|
-
}
|
4807
|
+
}
|
4808
|
+
|
4809
|
+
|
4810
|
+
/**
|
4811
|
+
* @ngdoc method
|
4812
|
+
* @name ng.$interpolate#startSymbol
|
4813
|
+
* @methodOf ng.$interpolate
|
4814
|
+
* @description
|
4815
|
+
* Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.
|
4816
|
+
*
|
4817
|
+
* Use {@link ng.$interpolateProvider#startSymbol $interpolateProvider#startSymbol} to change
|
4818
|
+
* the symbol.
|
4819
|
+
*
|
4820
|
+
* @returns {string} start symbol.
|
4821
|
+
*/
|
4822
|
+
$interpolate.startSymbol = function() {
|
4823
|
+
return startSymbol;
|
4824
|
+
}
|
4825
|
+
|
4826
|
+
|
4827
|
+
/**
|
4828
|
+
* @ngdoc method
|
4829
|
+
* @name ng.$interpolate#endSymbol
|
4830
|
+
* @methodOf ng.$interpolate
|
4831
|
+
* @description
|
4832
|
+
* Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
|
4833
|
+
*
|
4834
|
+
* Use {@link ng.$interpolateProvider#endSymbol $interpolateProvider#endSymbol} to change
|
4835
|
+
* the symbol.
|
4836
|
+
*
|
4837
|
+
* @returns {string} start symbol.
|
4838
|
+
*/
|
4839
|
+
$interpolate.endSymbol = function() {
|
4840
|
+
return endSymbol;
|
4841
|
+
}
|
4842
|
+
|
4843
|
+
return $interpolate;
|
4805
4844
|
}];
|
4806
4845
|
}
|
4807
4846
|
|
@@ -5433,27 +5472,25 @@ function $LocationProvider(){
|
|
5433
5472
|
* The main purpose of this service is to simplify debugging and troubleshooting.
|
5434
5473
|
*
|
5435
5474
|
* @example
|
5436
|
-
|
5437
|
-
|
5438
|
-
|
5439
|
-
|
5440
|
-
|
5441
|
-
|
5442
|
-
|
5443
|
-
|
5444
|
-
|
5445
|
-
|
5446
|
-
|
5447
|
-
|
5448
|
-
|
5449
|
-
|
5450
|
-
|
5451
|
-
|
5452
|
-
|
5453
|
-
|
5454
|
-
|
5455
|
-
</doc:scenario>
|
5456
|
-
</doc:example>
|
5475
|
+
<example>
|
5476
|
+
<file name="script.js">
|
5477
|
+
function LogCtrl($scope, $log) {
|
5478
|
+
$scope.$log = $log;
|
5479
|
+
$scope.message = 'Hello World!';
|
5480
|
+
}
|
5481
|
+
</file>
|
5482
|
+
<file name="index.html">
|
5483
|
+
<div ng-controller="LogCtrl">
|
5484
|
+
<p>Reload this page with open console, enter text and hit the log button...</p>
|
5485
|
+
Message:
|
5486
|
+
<input type="text" ng-model="message"/>
|
5487
|
+
<button ng-click="$log.log(message)">log</button>
|
5488
|
+
<button ng-click="$log.warn(message)">warn</button>
|
5489
|
+
<button ng-click="$log.info(message)">info</button>
|
5490
|
+
<button ng-click="$log.error(message)">error</button>
|
5491
|
+
</div>
|
5492
|
+
</file>
|
5493
|
+
</example>
|
5457
5494
|
*/
|
5458
5495
|
|
5459
5496
|
function $LogProvider(){
|
@@ -6810,8 +6847,9 @@ function $RouteProvider(){
|
|
6810
6847
|
*
|
6811
6848
|
* Object properties:
|
6812
6849
|
*
|
6813
|
-
* - `controller` – `{function()=}` – Controller fn that should be associated with newly
|
6814
|
-
* created scope.
|
6850
|
+
* - `controller` – `{(string|function()=}` – Controller fn that should be associated with newly
|
6851
|
+
* created scope or the name of a {@link angular.Module#controller registered controller}
|
6852
|
+
* if passed as a string.
|
6815
6853
|
* - `template` – `{string=}` – html template as a string that should be used by
|
6816
6854
|
* {@link ng.directive:ngView ngView} or
|
6817
6855
|
* {@link ng.directive:ngInclude ngInclude} directives.
|
@@ -6821,7 +6859,7 @@ function $RouteProvider(){
|
|
6821
6859
|
* - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should
|
6822
6860
|
* be injected into the controller. If any of these dependencies are promises, they will be
|
6823
6861
|
* resolved and converted to a value before the controller is instantiated and the
|
6824
|
-
* `$
|
6862
|
+
* `$afterRouteChange` event is fired. The map object is:
|
6825
6863
|
*
|
6826
6864
|
* - `key` – `{string}`: a name of a dependency to be injected into the controller.
|
6827
6865
|
* - `factory` - `{string|function}`: If `string` then it is an alias for a service.
|
@@ -7587,9 +7625,9 @@ function $RootScopeProvider(){
|
|
7587
7625
|
*
|
7588
7626
|
* Usually you don't call `$digest()` directly in
|
7589
7627
|
* {@link ng.directive:ngController controllers} or in
|
7590
|
-
* {@link ng.$compileProvider
|
7628
|
+
* {@link ng.$compileProvider#directive directives}.
|
7591
7629
|
* Instead a call to {@link ng.$rootScope.Scope#$apply $apply()} (typically from within a
|
7592
|
-
* {@link ng.$compileProvider
|
7630
|
+
* {@link ng.$compileProvider#directive directives}) will force a `$digest()`.
|
7593
7631
|
*
|
7594
7632
|
* If you want to be notified whenever `$digest()` is called,
|
7595
7633
|
* you can register a `watchExpression` function with {@link ng.$rootScope.Scope#$watch $watch()}
|
@@ -7875,8 +7913,8 @@ function $RootScopeProvider(){
|
|
7875
7913
|
* @param {function(event)} listener Function to call when the event is emitted.
|
7876
7914
|
* @returns {function()} Returns a deregistration function for this listener.
|
7877
7915
|
*
|
7878
|
-
* The event listener function format is: `function(event)`. The `event` object
|
7879
|
-
* listener has the following attributes
|
7916
|
+
* The event listener function format is: `function(event, args...)`. The `event` object
|
7917
|
+
* passed into the listener has the following attributes:
|
7880
7918
|
*
|
7881
7919
|
* - `targetScope` - {Scope}: the scope on which the event was `$emit`-ed or `$broadcast`-ed.
|
7882
7920
|
* - `currentScope` - {Scope}: the current scope which is handling the event.
|
@@ -10105,7 +10143,12 @@ function ngDirective(directive) {
|
|
10105
10143
|
return valueFn(directive);
|
10106
10144
|
}
|
10107
10145
|
|
10108
|
-
|
10146
|
+
/**
|
10147
|
+
* @ngdoc directive
|
10148
|
+
* @name ng.directive:a
|
10149
|
+
* @restrict E
|
10150
|
+
*
|
10151
|
+
* @description
|
10109
10152
|
* Modifies the default behavior of html A tag, so that the default action is prevented when href
|
10110
10153
|
* attribute is empty.
|
10111
10154
|
*
|
@@ -10673,41 +10716,65 @@ function FormController(element, attrs) {
|
|
10673
10716
|
</doc:scenario>
|
10674
10717
|
</doc:example>
|
10675
10718
|
*/
|
10676
|
-
var
|
10677
|
-
|
10678
|
-
|
10679
|
-
|
10680
|
-
|
10681
|
-
|
10682
|
-
|
10683
|
-
|
10684
|
-
|
10685
|
-
|
10686
|
-
|
10687
|
-
|
10719
|
+
var formDirectiveFactory = function(isNgForm) {
|
10720
|
+
return ['$timeout', function($timeout) {
|
10721
|
+
var formDirective = {
|
10722
|
+
name: 'form',
|
10723
|
+
restrict: 'E',
|
10724
|
+
controller: FormController,
|
10725
|
+
compile: function() {
|
10726
|
+
return {
|
10727
|
+
pre: function(scope, formElement, attr, controller) {
|
10728
|
+
if (!attr.action) {
|
10729
|
+
// we can't use jq events because if a form is destroyed during submission the default
|
10730
|
+
// action is not prevented. see #1238
|
10731
|
+
//
|
10732
|
+
// IE 9 is not affected because it doesn't fire a submit event and try to do a full
|
10733
|
+
// page reload if the form was destroyed by submission of the form via a click handler
|
10734
|
+
// on a button in the form. Looks like an IE9 specific bug.
|
10735
|
+
var preventDefaultListener = function(event) {
|
10736
|
+
event.preventDefault
|
10737
|
+
? event.preventDefault()
|
10738
|
+
: event.returnValue = false; // IE
|
10739
|
+
};
|
10688
10740
|
|
10689
|
-
|
10690
|
-
|
10741
|
+
addEventListenerFn(formElement[0], 'submit', preventDefaultListener);
|
10742
|
+
|
10743
|
+
// unregister the preventDefault listener so that we don't not leak memory but in a
|
10744
|
+
// way that will achieve the prevention of the default action.
|
10745
|
+
formElement.bind('$destroy', function() {
|
10746
|
+
$timeout(function() {
|
10747
|
+
removeEventListenerFn(formElement[0], 'submit', preventDefaultListener);
|
10748
|
+
}, 0, false);
|
10749
|
+
});
|
10750
|
+
}
|
10751
|
+
|
10752
|
+
var parentFormCtrl = formElement.parent().controller('form'),
|
10753
|
+
alias = attr.name || attr.ngForm;
|
10691
10754
|
|
10692
|
-
if (alias) {
|
10693
|
-
scope[alias] = controller;
|
10694
|
-
}
|
10695
|
-
if (parentFormCtrl) {
|
10696
|
-
formElement.bind('$destroy', function() {
|
10697
|
-
parentFormCtrl.$removeControl(controller);
|
10698
10755
|
if (alias) {
|
10699
|
-
scope[alias] =
|
10756
|
+
scope[alias] = controller;
|
10700
10757
|
}
|
10701
|
-
|
10702
|
-
|
10703
|
-
|
10758
|
+
if (parentFormCtrl) {
|
10759
|
+
formElement.bind('$destroy', function() {
|
10760
|
+
parentFormCtrl.$removeControl(controller);
|
10761
|
+
if (alias) {
|
10762
|
+
scope[alias] = undefined;
|
10763
|
+
}
|
10764
|
+
extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards
|
10765
|
+
});
|
10766
|
+
}
|
10767
|
+
}
|
10768
|
+
};
|
10704
10769
|
}
|
10705
10770
|
};
|
10706
|
-
|
10771
|
+
|
10772
|
+
return isNgForm ? extend(copy(formDirective), {restrict: 'EAC'}) : formDirective;
|
10773
|
+
}];
|
10707
10774
|
};
|
10708
10775
|
|
10709
|
-
var formDirective =
|
10710
|
-
var ngFormDirective =
|
10776
|
+
var formDirective = formDirectiveFactory();
|
10777
|
+
var ngFormDirective = formDirectiveFactory(true);
|
10711
10778
|
|
10712
10779
|
var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
|
10713
10780
|
var EMAIL_REGEXP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/;
|
@@ -11928,7 +11995,7 @@ var ngListDirective = function() {
|
|
11928
11995
|
|
11929
11996
|
ctrl.$parsers.push(parse);
|
11930
11997
|
ctrl.$formatters.push(function(value) {
|
11931
|
-
if (isArray(value)
|
11998
|
+
if (isArray(value)) {
|
11932
11999
|
return value.join(', ');
|
11933
12000
|
}
|
11934
12001
|
|
@@ -13045,11 +13112,14 @@ var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interp
|
|
13045
13112
|
whenExp = element.attr(attr.$attr.when), // this is because we have {{}} in attrs
|
13046
13113
|
offset = attr.offset || 0,
|
13047
13114
|
whens = scope.$eval(whenExp),
|
13048
|
-
whensExpFns = {}
|
13115
|
+
whensExpFns = {},
|
13116
|
+
startSymbol = $interpolate.startSymbol(),
|
13117
|
+
endSymbol = $interpolate.endSymbol();
|
13049
13118
|
|
13050
13119
|
forEach(whens, function(expression, key) {
|
13051
13120
|
whensExpFns[key] =
|
13052
|
-
$interpolate(expression.replace(BRACE,
|
13121
|
+
$interpolate(expression.replace(BRACE, startSymbol + numberExp + '-' +
|
13122
|
+
offset + endSymbol));
|
13053
13123
|
});
|
13054
13124
|
|
13055
13125
|
scope.$watch(function() {
|
@@ -14273,7 +14343,6 @@ var optionDirective = ['$interpolate', function($interpolate) {
|
|
14273
14343
|
return {
|
14274
14344
|
restrict: 'E',
|
14275
14345
|
priority: 100,
|
14276
|
-
require: '^select',
|
14277
14346
|
compile: function(element, attr) {
|
14278
14347
|
if (isUndefined(attr.value)) {
|
14279
14348
|
var interpolateFn = $interpolate(element.text(), true);
|
@@ -14282,8 +14351,13 @@ var optionDirective = ['$interpolate', function($interpolate) {
|
|
14282
14351
|
}
|
14283
14352
|
}
|
14284
14353
|
|
14285
|
-
return function (scope, element, attr
|
14286
|
-
|
14354
|
+
return function (scope, element, attr) {
|
14355
|
+
var selectCtrlName = '$selectController',
|
14356
|
+
parent = element.parent(),
|
14357
|
+
selectCtrl = parent.data(selectCtrlName) ||
|
14358
|
+
parent.parent().data(selectCtrlName); // in case we are in optgroup
|
14359
|
+
|
14360
|
+
if (selectCtrl && selectCtrl.databound) {
|
14287
14361
|
// For some reason Opera defaults to true and if not overridden this messes up the repeater.
|
14288
14362
|
// We don't want the view to drive the initialization of the model anyway.
|
14289
14363
|
element.prop('selected', false);
|