angularjs-rails 1.2.0 → 1.2.1
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 +1 -1
- data/vendor/assets/javascripts/angular-cookies.js +1 -1
- data/vendor/assets/javascripts/angular-loader.js +86 -4
- data/vendor/assets/javascripts/angular-mocks.js +2 -17
- data/vendor/assets/javascripts/angular-resource.js +28 -60
- data/vendor/assets/javascripts/angular-route.js +3 -5
- data/vendor/assets/javascripts/angular-sanitize.js +1 -1
- data/vendor/assets/javascripts/angular-scenario.js +271 -171
- data/vendor/assets/javascripts/angular-touch.js +1 -1
- data/vendor/assets/javascripts/angular.js +271 -171
- metadata +2 -2
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.1
|
3
3
|
* (c) 2010-2012 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -40,11 +40,11 @@ function minErr(module) {
|
|
40
40
|
template = arguments[1],
|
41
41
|
templateArgs = arguments,
|
42
42
|
stringify = function (obj) {
|
43
|
-
if (
|
43
|
+
if (typeof obj === 'function') {
|
44
44
|
return obj.toString().replace(/ \{[\s\S]*$/, '');
|
45
|
-
} else if (
|
45
|
+
} else if (typeof obj === 'undefined') {
|
46
46
|
return 'undefined';
|
47
|
-
} else if (
|
47
|
+
} else if (typeof obj !== 'string') {
|
48
48
|
return JSON.stringify(obj);
|
49
49
|
}
|
50
50
|
return obj;
|
@@ -56,11 +56,11 @@ function minErr(module) {
|
|
56
56
|
|
57
57
|
if (index + 2 < templateArgs.length) {
|
58
58
|
arg = templateArgs[index + 2];
|
59
|
-
if (
|
59
|
+
if (typeof arg === 'function') {
|
60
60
|
return arg.toString().replace(/ ?\{[\s\S]*$/, '');
|
61
|
-
} else if (
|
61
|
+
} else if (typeof arg === 'undefined') {
|
62
62
|
return 'undefined';
|
63
|
-
} else if (
|
63
|
+
} else if (typeof arg !== 'string') {
|
64
64
|
return toJson(arg);
|
65
65
|
}
|
66
66
|
return arg;
|
@@ -68,7 +68,7 @@ function minErr(module) {
|
|
68
68
|
return match;
|
69
69
|
});
|
70
70
|
|
71
|
-
message = message + '\nhttp://errors.angularjs.org/
|
71
|
+
message = message + '\nhttp://errors.angularjs.org/1.2.1/' +
|
72
72
|
(module ? module + '/' : '') + code;
|
73
73
|
for (i = 2; i < arguments.length; i++) {
|
74
74
|
message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
|
@@ -1429,6 +1429,7 @@ function getBlockElements(block) {
|
|
1429
1429
|
function setupModuleLoader(window) {
|
1430
1430
|
|
1431
1431
|
var $injectorMinErr = minErr('$injector');
|
1432
|
+
var ngMinErr = minErr('ng');
|
1432
1433
|
|
1433
1434
|
function ensure(obj, name, factory) {
|
1434
1435
|
return obj[name] || (obj[name] = factory());
|
@@ -1489,6 +1490,12 @@ function setupModuleLoader(window) {
|
|
1489
1490
|
* @returns {module} new module with the {@link angular.Module} api.
|
1490
1491
|
*/
|
1491
1492
|
return function module(name, requires, configFn) {
|
1493
|
+
var assertNotHasOwnProperty = function(name, context) {
|
1494
|
+
if (name === 'hasOwnProperty') {
|
1495
|
+
throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
|
1496
|
+
}
|
1497
|
+
};
|
1498
|
+
|
1492
1499
|
assertNotHasOwnProperty(name, 'module');
|
1493
1500
|
if (requires && modules.hasOwnProperty(name)) {
|
1494
1501
|
modules[name] = null;
|
@@ -1801,11 +1808,11 @@ function setupModuleLoader(window) {
|
|
1801
1808
|
* - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
|
1802
1809
|
*/
|
1803
1810
|
var version = {
|
1804
|
-
full: '1.2.
|
1811
|
+
full: '1.2.1', // all of these placeholder strings will be replaced by grunt's
|
1805
1812
|
major: 1, // package task
|
1806
|
-
minor:
|
1807
|
-
dot:
|
1808
|
-
codeName: '
|
1813
|
+
minor: 2,
|
1814
|
+
dot: 1,
|
1815
|
+
codeName: 'underscore-empathy'
|
1809
1816
|
};
|
1810
1817
|
|
1811
1818
|
|
@@ -4696,8 +4703,9 @@ function $TemplateCacheProvider() {
|
|
4696
4703
|
* When there are multiple directives defined on a single DOM element, sometimes it
|
4697
4704
|
* is necessary to specify the order in which the directives are applied. The `priority` is used
|
4698
4705
|
* to sort the directives before their `compile` functions get called. Priority is defined as a
|
4699
|
-
* number. Directives with greater numerical `priority` are compiled first.
|
4700
|
-
*
|
4706
|
+
* number. Directives with greater numerical `priority` are compiled first. Pre-link functions
|
4707
|
+
* are also run in priority order, but post-link functions are run in reverse order. The order
|
4708
|
+
* of directives with the same priority is undefined. The default priority is `0`.
|
4701
4709
|
*
|
4702
4710
|
* #### `terminal`
|
4703
4711
|
* If set to true then the current `priority` will be the last set of directives
|
@@ -4758,8 +4766,9 @@ function $TemplateCacheProvider() {
|
|
4758
4766
|
* * `$scope` - Current scope associated with the element
|
4759
4767
|
* * `$element` - Current element
|
4760
4768
|
* * `$attrs` - Current attributes object for the element
|
4761
|
-
* * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope
|
4762
|
-
*
|
4769
|
+
* * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope.
|
4770
|
+
* The scope can be overridden by an optional first argument.
|
4771
|
+
* `function([scope], cloneLinkingFn)`.
|
4763
4772
|
*
|
4764
4773
|
*
|
4765
4774
|
* #### `require`
|
@@ -4852,7 +4861,7 @@ function $TemplateCacheProvider() {
|
|
4852
4861
|
* * `tAttrs` - template attributes - Normalized list of attributes declared on this element shared
|
4853
4862
|
* between all directive compile functions.
|
4854
4863
|
*
|
4855
|
-
* * `transclude` - A transclude linking function: `function(scope, cloneLinkingFn)
|
4864
|
+
* * `transclude` - [*DEPRECATED*!] A transclude linking function: `function(scope, cloneLinkingFn)`
|
4856
4865
|
*
|
4857
4866
|
* <div class="alert alert-warning">
|
4858
4867
|
* **Note:** The template instance and the link instance may be different objects if the template has
|
@@ -4861,6 +4870,12 @@ function $TemplateCacheProvider() {
|
|
4861
4870
|
* should be done in a linking function rather than in a compile function.
|
4862
4871
|
* </div>
|
4863
4872
|
*
|
4873
|
+
* <div class="alert alert-error">
|
4874
|
+
* **Note:** The `transclude` function that is passed to the compile function is deperecated, as it
|
4875
|
+
* e.g. does not know about the right outer scope. Please use the transclude function that is passed
|
4876
|
+
* to the link function instead.
|
4877
|
+
* </div>
|
4878
|
+
|
4864
4879
|
* A compile function can have a return value which can be either a function or an object.
|
4865
4880
|
*
|
4866
4881
|
* * returning a (post-link) function - is equivalent to registering the linking function via the
|
@@ -4875,7 +4890,7 @@ function $TemplateCacheProvider() {
|
|
4875
4890
|
* This property is used only if the `compile` property is not defined.
|
4876
4891
|
*
|
4877
4892
|
* <pre>
|
4878
|
-
* function link(scope, iElement, iAttrs, controller) { ... }
|
4893
|
+
* function link(scope, iElement, iAttrs, controller, transcludeFn) { ... }
|
4879
4894
|
* </pre>
|
4880
4895
|
*
|
4881
4896
|
* The link function is responsible for registering DOM listeners as well as updating the DOM. It is
|
@@ -4896,6 +4911,10 @@ function $TemplateCacheProvider() {
|
|
4896
4911
|
* element defines a controller. The controller is shared among all the directives, which allows
|
4897
4912
|
* the directives to use the controllers as a communication channel.
|
4898
4913
|
*
|
4914
|
+
* * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope.
|
4915
|
+
* The scope can be overridden by an optional first argument. This is the same as the `$transclude`
|
4916
|
+
* parameter of directive controllers.
|
4917
|
+
* `function([scope], cloneLinkingFn)`.
|
4899
4918
|
*
|
4900
4919
|
*
|
4901
4920
|
* #### Pre-linking function
|
@@ -5401,7 +5420,7 @@ function $CompileProvider($provide) {
|
|
5401
5420
|
var compositeLinkFn =
|
5402
5421
|
compileNodes($compileNodes, transcludeFn, $compileNodes,
|
5403
5422
|
maxPriority, ignoreDirective, previousCompileContext);
|
5404
|
-
return function publicLinkFn(scope, cloneConnectFn){
|
5423
|
+
return function publicLinkFn(scope, cloneConnectFn, transcludeControllers){
|
5405
5424
|
assertArg(scope, 'scope');
|
5406
5425
|
// important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart
|
5407
5426
|
// and sometimes changes the structure of the DOM.
|
@@ -5409,6 +5428,10 @@ function $CompileProvider($provide) {
|
|
5409
5428
|
? JQLitePrototype.clone.call($compileNodes) // IMPORTANT!!!
|
5410
5429
|
: $compileNodes;
|
5411
5430
|
|
5431
|
+
forEach(transcludeControllers, function(instance, name) {
|
5432
|
+
$linkNode.data('$' + name + 'Controller', instance);
|
5433
|
+
});
|
5434
|
+
|
5412
5435
|
// Attach scope only to non-text nodes.
|
5413
5436
|
for(var i = 0, ii = $linkNode.length; i<ii; i++) {
|
5414
5437
|
var node = $linkNode[i];
|
@@ -5507,15 +5530,7 @@ function $CompileProvider($provide) {
|
|
5507
5530
|
childTranscludeFn = nodeLinkFn.transclude;
|
5508
5531
|
if (childTranscludeFn || (!boundTranscludeFn && transcludeFn)) {
|
5509
5532
|
nodeLinkFn(childLinkFn, childScope, node, $rootElement,
|
5510
|
-
|
5511
|
-
return function(cloneFn) {
|
5512
|
-
var transcludeScope = scope.$new();
|
5513
|
-
transcludeScope.$$transcluded = true;
|
5514
|
-
|
5515
|
-
return transcludeFn(transcludeScope, cloneFn).
|
5516
|
-
on('$destroy', bind(transcludeScope, transcludeScope.$destroy));
|
5517
|
-
};
|
5518
|
-
})(childTranscludeFn || transcludeFn)
|
5533
|
+
createBoundTranscludeFn(scope, childTranscludeFn || transcludeFn)
|
5519
5534
|
);
|
5520
5535
|
} else {
|
5521
5536
|
nodeLinkFn(childLinkFn, childScope, node, undefined, boundTranscludeFn);
|
@@ -5527,6 +5542,23 @@ function $CompileProvider($provide) {
|
|
5527
5542
|
}
|
5528
5543
|
}
|
5529
5544
|
|
5545
|
+
function createBoundTranscludeFn(scope, transcludeFn) {
|
5546
|
+
return function boundTranscludeFn(transcludedScope, cloneFn, controllers) {
|
5547
|
+
var scopeCreated = false;
|
5548
|
+
|
5549
|
+
if (!transcludedScope) {
|
5550
|
+
transcludedScope = scope.$new();
|
5551
|
+
transcludedScope.$$transcluded = true;
|
5552
|
+
scopeCreated = true;
|
5553
|
+
}
|
5554
|
+
|
5555
|
+
var clone = transcludeFn(transcludedScope, cloneFn, controllers);
|
5556
|
+
if (scopeCreated) {
|
5557
|
+
clone.on('$destroy', bind(transcludedScope, transcludedScope.$destroy));
|
5558
|
+
}
|
5559
|
+
return clone;
|
5560
|
+
};
|
5561
|
+
}
|
5530
5562
|
|
5531
5563
|
/**
|
5532
5564
|
* Looks for directives on the given node and adds them to the directive collection which is
|
@@ -5664,9 +5696,9 @@ function $CompileProvider($provide) {
|
|
5664
5696
|
* @returns {Function}
|
5665
5697
|
*/
|
5666
5698
|
function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) {
|
5667
|
-
return function(scope, element, attrs, controllers) {
|
5699
|
+
return function(scope, element, attrs, controllers, transcludeFn) {
|
5668
5700
|
element = groupScan(element[0], attrStart, attrEnd);
|
5669
|
-
return linkFn(scope, element, attrs, controllers);
|
5701
|
+
return linkFn(scope, element, attrs, controllers, transcludeFn);
|
5670
5702
|
};
|
5671
5703
|
}
|
5672
5704
|
|
@@ -5703,7 +5735,9 @@ function $CompileProvider($provide) {
|
|
5703
5735
|
controllerDirectives = previousCompileContext.controllerDirectives,
|
5704
5736
|
newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,
|
5705
5737
|
templateDirective = previousCompileContext.templateDirective,
|
5706
|
-
|
5738
|
+
nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,
|
5739
|
+
hasTranscludeDirective = false,
|
5740
|
+
hasElementTranscludeDirective = false,
|
5707
5741
|
$compileNode = templateAttrs.$$element = jqLite(compileNode),
|
5708
5742
|
directive,
|
5709
5743
|
directiveName,
|
@@ -5754,15 +5788,18 @@ function $CompileProvider($provide) {
|
|
5754
5788
|
}
|
5755
5789
|
|
5756
5790
|
if (directiveValue = directive.transclude) {
|
5791
|
+
hasTranscludeDirective = true;
|
5792
|
+
|
5757
5793
|
// Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion.
|
5758
5794
|
// This option should only be used by directives that know how to how to safely handle element transclusion,
|
5759
5795
|
// where the transcluded nodes are added or replaced after linking.
|
5760
5796
|
if (!directive.$$tlb) {
|
5761
|
-
assertNoDuplicate('transclusion',
|
5762
|
-
|
5797
|
+
assertNoDuplicate('transclusion', nonTlbTranscludeDirective, directive, $compileNode);
|
5798
|
+
nonTlbTranscludeDirective = directive;
|
5763
5799
|
}
|
5764
5800
|
|
5765
5801
|
if (directiveValue == 'element') {
|
5802
|
+
hasElementTranscludeDirective = true;
|
5766
5803
|
terminalPriority = directive.priority;
|
5767
5804
|
$template = groupScan(compileNode, attrStart, attrEnd);
|
5768
5805
|
$compileNode = templateAttrs.$$element =
|
@@ -5778,9 +5815,9 @@ function $CompileProvider($provide) {
|
|
5778
5815
|
// - newIsolateScopeDirective or templateDirective - combining templates with
|
5779
5816
|
// element transclusion doesn't make sense.
|
5780
5817
|
//
|
5781
|
-
// We need only
|
5818
|
+
// We need only nonTlbTranscludeDirective so that we prevent putting transclusion
|
5782
5819
|
// on the same element more than once.
|
5783
|
-
|
5820
|
+
nonTlbTranscludeDirective: nonTlbTranscludeDirective
|
5784
5821
|
});
|
5785
5822
|
} else {
|
5786
5823
|
$template = jqLite(jqLiteClone(compileNode)).contents();
|
@@ -5849,7 +5886,7 @@ function $CompileProvider($provide) {
|
|
5849
5886
|
controllerDirectives: controllerDirectives,
|
5850
5887
|
newIsolateScopeDirective: newIsolateScopeDirective,
|
5851
5888
|
templateDirective: templateDirective,
|
5852
|
-
|
5889
|
+
nonTlbTranscludeDirective: nonTlbTranscludeDirective
|
5853
5890
|
});
|
5854
5891
|
ii = directives.length;
|
5855
5892
|
} else if (directive.compile) {
|
@@ -5873,7 +5910,7 @@ function $CompileProvider($provide) {
|
|
5873
5910
|
}
|
5874
5911
|
|
5875
5912
|
nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true;
|
5876
|
-
nodeLinkFn.transclude =
|
5913
|
+
nodeLinkFn.transclude = hasTranscludeDirective && childTranscludeFn;
|
5877
5914
|
|
5878
5915
|
// might be normal or delayed nodeLinkFn depending on if templateUrl is present
|
5879
5916
|
return nodeLinkFn;
|
@@ -5900,7 +5937,7 @@ function $CompileProvider($provide) {
|
|
5900
5937
|
}
|
5901
5938
|
|
5902
5939
|
|
5903
|
-
function getControllers(require, $element) {
|
5940
|
+
function getControllers(require, $element, elementControllers) {
|
5904
5941
|
var value, retrievalMethod = 'data', optional = false;
|
5905
5942
|
if (isString(require)) {
|
5906
5943
|
while((value = require.charAt(0)) == '^' || value == '?') {
|
@@ -5910,13 +5947,12 @@ function $CompileProvider($provide) {
|
|
5910
5947
|
}
|
5911
5948
|
optional = optional || value == '?';
|
5912
5949
|
}
|
5950
|
+
value = null;
|
5913
5951
|
|
5914
|
-
|
5915
|
-
|
5916
|
-
if ($element[0].nodeType == 8 && $element[0].$$controller) { // Transclusion comment node
|
5917
|
-
value = value || $element[0].$$controller;
|
5918
|
-
$element[0].$$controller = null;
|
5952
|
+
if (elementControllers && retrievalMethod === 'data') {
|
5953
|
+
value = elementControllers[require];
|
5919
5954
|
}
|
5955
|
+
value = value || $element[retrievalMethod]('$' + require + 'Controller');
|
5920
5956
|
|
5921
5957
|
if (!value && !optional) {
|
5922
5958
|
throw $compileMinErr('ctreq',
|
@@ -5927,7 +5963,7 @@ function $CompileProvider($provide) {
|
|
5927
5963
|
} else if (isArray(require)) {
|
5928
5964
|
value = [];
|
5929
5965
|
forEach(require, function(require) {
|
5930
|
-
value.push(getControllers(require, $element));
|
5966
|
+
value.push(getControllers(require, $element, elementControllers));
|
5931
5967
|
});
|
5932
5968
|
}
|
5933
5969
|
return value;
|
@@ -5935,7 +5971,7 @@ function $CompileProvider($provide) {
|
|
5935
5971
|
|
5936
5972
|
|
5937
5973
|
function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {
|
5938
|
-
var attrs, $element, i, ii, linkFn, controller, isolateScope;
|
5974
|
+
var attrs, $element, i, ii, linkFn, controller, isolateScope, elementControllers = {}, transcludeFn;
|
5939
5975
|
|
5940
5976
|
if (compileNode === linkNode) {
|
5941
5977
|
attrs = templateAttrs;
|
@@ -6029,14 +6065,14 @@ function $CompileProvider($provide) {
|
|
6029
6065
|
}
|
6030
6066
|
});
|
6031
6067
|
}
|
6032
|
-
|
6068
|
+
transcludeFn = boundTranscludeFn && controllersBoundTransclude;
|
6033
6069
|
if (controllerDirectives) {
|
6034
6070
|
forEach(controllerDirectives, function(directive) {
|
6035
6071
|
var locals = {
|
6036
6072
|
$scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope,
|
6037
6073
|
$element: $element,
|
6038
6074
|
$attrs: attrs,
|
6039
|
-
$transclude:
|
6075
|
+
$transclude: transcludeFn
|
6040
6076
|
}, controllerInstance;
|
6041
6077
|
|
6042
6078
|
controller = directive.controller;
|
@@ -6045,16 +6081,16 @@ function $CompileProvider($provide) {
|
|
6045
6081
|
}
|
6046
6082
|
|
6047
6083
|
controllerInstance = $controller(controller, locals);
|
6048
|
-
|
6049
|
-
//
|
6050
|
-
//
|
6051
|
-
//
|
6052
|
-
//
|
6053
|
-
|
6054
|
-
|
6055
|
-
} else {
|
6084
|
+
// For directives with element transclusion the element is a comment,
|
6085
|
+
// but jQuery .data doesn't support attaching data to comment nodes as it's hard to
|
6086
|
+
// clean up (http://bugs.jquery.com/ticket/8335).
|
6087
|
+
// Instead, we save the controllers for the element in a local hash and attach to .data
|
6088
|
+
// later, once we have the actual element.
|
6089
|
+
elementControllers[directive.name] = controllerInstance;
|
6090
|
+
if (!hasElementTranscludeDirective) {
|
6056
6091
|
$element.data('$' + directive.name + 'Controller', controllerInstance);
|
6057
6092
|
}
|
6093
|
+
|
6058
6094
|
if (directive.controllerAs) {
|
6059
6095
|
locals.$scope[directive.controllerAs] = controllerInstance;
|
6060
6096
|
}
|
@@ -6066,7 +6102,7 @@ function $CompileProvider($provide) {
|
|
6066
6102
|
try {
|
6067
6103
|
linkFn = preLinkFns[i];
|
6068
6104
|
linkFn(linkFn.isolateScope ? isolateScope : scope, $element, attrs,
|
6069
|
-
linkFn.require && getControllers(linkFn.require, $element));
|
6105
|
+
linkFn.require && getControllers(linkFn.require, $element, elementControllers), transcludeFn);
|
6070
6106
|
} catch (e) {
|
6071
6107
|
$exceptionHandler(e, startingTag($element));
|
6072
6108
|
}
|
@@ -6086,11 +6122,28 @@ function $CompileProvider($provide) {
|
|
6086
6122
|
try {
|
6087
6123
|
linkFn = postLinkFns[i];
|
6088
6124
|
linkFn(linkFn.isolateScope ? isolateScope : scope, $element, attrs,
|
6089
|
-
linkFn.require && getControllers(linkFn.require, $element));
|
6125
|
+
linkFn.require && getControllers(linkFn.require, $element, elementControllers), transcludeFn);
|
6090
6126
|
} catch (e) {
|
6091
6127
|
$exceptionHandler(e, startingTag($element));
|
6092
6128
|
}
|
6093
6129
|
}
|
6130
|
+
|
6131
|
+
// This is the function that is injected as `$transclude`.
|
6132
|
+
function controllersBoundTransclude(scope, cloneAttachFn) {
|
6133
|
+
var transcludeControllers;
|
6134
|
+
|
6135
|
+
// no scope passed
|
6136
|
+
if (arguments.length < 2) {
|
6137
|
+
cloneAttachFn = scope;
|
6138
|
+
scope = undefined;
|
6139
|
+
}
|
6140
|
+
|
6141
|
+
if (hasElementTranscludeDirective) {
|
6142
|
+
transcludeControllers = elementControllers;
|
6143
|
+
}
|
6144
|
+
|
6145
|
+
return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers);
|
6146
|
+
}
|
6094
6147
|
}
|
6095
6148
|
}
|
6096
6149
|
|
@@ -6169,6 +6222,7 @@ function $CompileProvider($provide) {
|
|
6169
6222
|
dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value;
|
6170
6223
|
} else if (key == 'style') {
|
6171
6224
|
$element.attr('style', $element.attr('style') + ';' + value);
|
6225
|
+
dst['style'] = (dst['style'] ? dst['style'] + ';' : '') + value;
|
6172
6226
|
// `dst` will never contain hasOwnProperty as DOM parser won't let it.
|
6173
6227
|
// You will get an "InvalidCharacterError: DOM Exception 5" error if you
|
6174
6228
|
// have an attribute like "has-own-property" or "data-has-own-property", etc.
|
@@ -6199,7 +6253,7 @@ function $CompileProvider($provide) {
|
|
6199
6253
|
|
6200
6254
|
$http.get($sce.getTrustedResourceUrl(templateUrl), {cache: $templateCache}).
|
6201
6255
|
success(function(content) {
|
6202
|
-
var compileNode, tempTemplateAttrs, $template;
|
6256
|
+
var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn;
|
6203
6257
|
|
6204
6258
|
content = denormalizeTemplate(content);
|
6205
6259
|
|
@@ -6244,7 +6298,7 @@ function $CompileProvider($provide) {
|
|
6244
6298
|
var scope = linkQueue.shift(),
|
6245
6299
|
beforeTemplateLinkNode = linkQueue.shift(),
|
6246
6300
|
linkRootElement = linkQueue.shift(),
|
6247
|
-
|
6301
|
+
boundTranscludeFn = linkQueue.shift(),
|
6248
6302
|
linkNode = $compileNode[0];
|
6249
6303
|
|
6250
6304
|
if (beforeTemplateLinkNode !== beforeTemplateCompileNode) {
|
@@ -6252,9 +6306,13 @@ function $CompileProvider($provide) {
|
|
6252
6306
|
linkNode = jqLiteClone(compileNode);
|
6253
6307
|
replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode);
|
6254
6308
|
}
|
6255
|
-
|
6309
|
+
if (afterTemplateNodeLinkFn.transclude) {
|
6310
|
+
childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude);
|
6311
|
+
} else {
|
6312
|
+
childBoundTranscludeFn = boundTranscludeFn;
|
6313
|
+
}
|
6256
6314
|
afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement,
|
6257
|
-
|
6315
|
+
childBoundTranscludeFn);
|
6258
6316
|
}
|
6259
6317
|
linkQueue = null;
|
6260
6318
|
}).
|
@@ -6262,14 +6320,14 @@ function $CompileProvider($provide) {
|
|
6262
6320
|
throw $compileMinErr('tpload', 'Failed to load template: {0}', config.url);
|
6263
6321
|
});
|
6264
6322
|
|
6265
|
-
return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement,
|
6323
|
+
return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) {
|
6266
6324
|
if (linkQueue) {
|
6267
6325
|
linkQueue.push(scope);
|
6268
6326
|
linkQueue.push(node);
|
6269
6327
|
linkQueue.push(rootElement);
|
6270
|
-
linkQueue.push(
|
6328
|
+
linkQueue.push(boundTranscludeFn);
|
6271
6329
|
} else {
|
6272
|
-
afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement,
|
6330
|
+
afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, boundTranscludeFn);
|
6273
6331
|
}
|
6274
6332
|
};
|
6275
6333
|
}
|
@@ -6974,9 +7032,11 @@ function $HttpProvider() {
|
|
6974
7032
|
*
|
6975
7033
|
* # Caching
|
6976
7034
|
*
|
6977
|
-
* To enable caching, set the configuration
|
6978
|
-
*
|
6979
|
-
*
|
7035
|
+
* To enable caching, set the request configuration `cache` property to `true` (to use default
|
7036
|
+
* cache) or to a custom cache object (built with {@link ng.$cacheFactory `$cacheFactory`}).
|
7037
|
+
* When the cache is enabled, `$http` stores the response from the server in the specified
|
7038
|
+
* cache. The next time the same request is made, the response is served from the cache without
|
7039
|
+
* sending a request to the server.
|
6980
7040
|
*
|
6981
7041
|
* Note that even if the response is served from cache, delivery of the data is asynchronous in
|
6982
7042
|
* the same way that real requests are.
|
@@ -6985,9 +7045,13 @@ function $HttpProvider() {
|
|
6985
7045
|
* cache, but the cache is not populated yet, only one request to the server will be made and
|
6986
7046
|
* the remaining requests will be fulfilled using the response from the first request.
|
6987
7047
|
*
|
6988
|
-
*
|
6989
|
-
*
|
7048
|
+
* You can change the default cache to a new object (built with
|
7049
|
+
* {@link ng.$cacheFactory `$cacheFactory`}) by updating the
|
7050
|
+
* {@link ng.$http#properties_defaults `$http.defaults.cache`} property. All requests who set
|
7051
|
+
* their `cache` property to `true` will now use this cache object.
|
6990
7052
|
*
|
7053
|
+
* If you set the default cache to `false` then only requests that specify their own custom
|
7054
|
+
* cache object will be cached.
|
6991
7055
|
*
|
6992
7056
|
* # Interceptors
|
6993
7057
|
*
|
@@ -8251,8 +8315,8 @@ function encodePath(path) {
|
|
8251
8315
|
return segments.join('/');
|
8252
8316
|
}
|
8253
8317
|
|
8254
|
-
function parseAbsoluteUrl(absoluteUrl, locationObj) {
|
8255
|
-
var parsedUrl = urlResolve(absoluteUrl);
|
8318
|
+
function parseAbsoluteUrl(absoluteUrl, locationObj, appBase) {
|
8319
|
+
var parsedUrl = urlResolve(absoluteUrl, appBase);
|
8256
8320
|
|
8257
8321
|
locationObj.$$protocol = parsedUrl.protocol;
|
8258
8322
|
locationObj.$$host = parsedUrl.hostname;
|
@@ -8260,12 +8324,12 @@ function parseAbsoluteUrl(absoluteUrl, locationObj) {
|
|
8260
8324
|
}
|
8261
8325
|
|
8262
8326
|
|
8263
|
-
function parseAppUrl(relativeUrl, locationObj) {
|
8327
|
+
function parseAppUrl(relativeUrl, locationObj, appBase) {
|
8264
8328
|
var prefixed = (relativeUrl.charAt(0) !== '/');
|
8265
8329
|
if (prefixed) {
|
8266
8330
|
relativeUrl = '/' + relativeUrl;
|
8267
8331
|
}
|
8268
|
-
var match = urlResolve(relativeUrl);
|
8332
|
+
var match = urlResolve(relativeUrl, appBase);
|
8269
8333
|
locationObj.$$path = decodeURIComponent(prefixed && match.pathname.charAt(0) === '/' ?
|
8270
8334
|
match.pathname.substring(1) : match.pathname);
|
8271
8335
|
locationObj.$$search = parseKeyValue(match.search);
|
@@ -8320,7 +8384,7 @@ function LocationHtml5Url(appBase, basePrefix) {
|
|
8320
8384
|
this.$$html5 = true;
|
8321
8385
|
basePrefix = basePrefix || '';
|
8322
8386
|
var appBaseNoFile = stripFile(appBase);
|
8323
|
-
parseAbsoluteUrl(appBase, this);
|
8387
|
+
parseAbsoluteUrl(appBase, this, appBase);
|
8324
8388
|
|
8325
8389
|
|
8326
8390
|
/**
|
@@ -8335,7 +8399,7 @@ function LocationHtml5Url(appBase, basePrefix) {
|
|
8335
8399
|
appBaseNoFile);
|
8336
8400
|
}
|
8337
8401
|
|
8338
|
-
parseAppUrl(pathUrl, this);
|
8402
|
+
parseAppUrl(pathUrl, this, appBase);
|
8339
8403
|
|
8340
8404
|
if (!this.$$path) {
|
8341
8405
|
this.$$path = '/';
|
@@ -8387,7 +8451,7 @@ function LocationHtml5Url(appBase, basePrefix) {
|
|
8387
8451
|
function LocationHashbangUrl(appBase, hashPrefix) {
|
8388
8452
|
var appBaseNoFile = stripFile(appBase);
|
8389
8453
|
|
8390
|
-
parseAbsoluteUrl(appBase, this);
|
8454
|
+
parseAbsoluteUrl(appBase, this, appBase);
|
8391
8455
|
|
8392
8456
|
|
8393
8457
|
/**
|
@@ -8407,7 +8471,7 @@ function LocationHashbangUrl(appBase, hashPrefix) {
|
|
8407
8471
|
throw $locationMinErr('ihshprfx', 'Invalid url "{0}", missing hash prefix "{1}".', url,
|
8408
8472
|
hashPrefix);
|
8409
8473
|
}
|
8410
|
-
parseAppUrl(withoutHashUrl, this);
|
8474
|
+
parseAppUrl(withoutHashUrl, this, appBase);
|
8411
8475
|
this.$$compose();
|
8412
8476
|
};
|
8413
8477
|
|
@@ -9055,23 +9119,18 @@ var promiseWarning;
|
|
9055
9119
|
// ------------------------------
|
9056
9120
|
// Angular expressions are generally considered safe because these expressions only have direct
|
9057
9121
|
// access to $scope and locals. However, one can obtain the ability to execute arbitrary JS code by
|
9058
|
-
// obtaining a reference to native JS functions such as the Function constructor
|
9059
|
-
// or Document object. In addition, many powerful functions for use by JavaScript code are
|
9060
|
-
// published on scope that shouldn't be available from within an Angular expression.
|
9122
|
+
// obtaining a reference to native JS functions such as the Function constructor.
|
9061
9123
|
//
|
9062
9124
|
// As an example, consider the following Angular expression:
|
9063
9125
|
//
|
9064
9126
|
// {}.toString.constructor(alert("evil JS code"))
|
9065
9127
|
//
|
9066
9128
|
// We want to prevent this type of access. For the sake of performance, during the lexing phase we
|
9067
|
-
// disallow any "dotted" access to any member named "constructor"
|
9068
|
-
// or ends with an underscore. The latter allows one to exclude the private / JavaScript only API
|
9069
|
-
// available on the scope and controllers from the context of an Angular expression.
|
9129
|
+
// disallow any "dotted" access to any member named "constructor".
|
9070
9130
|
//
|
9071
|
-
// For reflective calls (a[b])
|
9072
|
-
//
|
9073
|
-
//
|
9074
|
-
// to static dereferencing.
|
9131
|
+
// For reflective calls (a[b]) we check that the value of the lookup is not the Function constructor
|
9132
|
+
// while evaluating the expression, which is a stronger but more expensive test. Since reflective
|
9133
|
+
// calls are expensive anyway, this is not such a big deal compared to static dereferencing.
|
9075
9134
|
//
|
9076
9135
|
// This sandboxing technique is not perfect and doesn't aim to be. The goal is to prevent exploits
|
9077
9136
|
// against the expression language, but not to prevent exploits that were enabled by exposing
|
@@ -9085,20 +9144,12 @@ var promiseWarning;
|
|
9085
9144
|
// In general, it is not possible to access a Window object from an angular expression unless a
|
9086
9145
|
// window or some DOM object that has a reference to window is published onto a Scope.
|
9087
9146
|
|
9088
|
-
function ensureSafeMemberName(name, fullExpression
|
9089
|
-
if (
|
9090
|
-
return name;
|
9091
|
-
}
|
9092
|
-
if (name === "constructor" && !allowConstructor) {
|
9147
|
+
function ensureSafeMemberName(name, fullExpression) {
|
9148
|
+
if (name === "constructor") {
|
9093
9149
|
throw $parseMinErr('isecfld',
|
9094
9150
|
'Referencing "constructor" field in Angular expressions is disallowed! Expression: {0}',
|
9095
9151
|
fullExpression);
|
9096
9152
|
}
|
9097
|
-
if (name.charAt(0) === '_' || name.charAt(name.length-1) === '_') {
|
9098
|
-
throw $parseMinErr('isecprv',
|
9099
|
-
'Referencing private fields in Angular expressions is disallowed! Expression: {0}',
|
9100
|
-
fullExpression);
|
9101
|
-
}
|
9102
9153
|
return name;
|
9103
9154
|
}
|
9104
9155
|
|
@@ -9782,10 +9833,7 @@ Parser.prototype = {
|
|
9782
9833
|
|
9783
9834
|
return extend(function(self, locals) {
|
9784
9835
|
var o = obj(self, locals),
|
9785
|
-
|
9786
|
-
// constructors. However, if value looked up is the Function constructor, we will still block it in the
|
9787
|
-
// ensureSafeObject call right after we look up o[i] (a few lines below.)
|
9788
|
-
i = ensureSafeMemberName(indexFn(self, locals), parser.text, true /* allowConstructor */),
|
9836
|
+
i = indexFn(self, locals),
|
9789
9837
|
v, p;
|
9790
9838
|
|
9791
9839
|
if (!o) return undefined;
|
@@ -9801,7 +9849,7 @@ Parser.prototype = {
|
|
9801
9849
|
return v;
|
9802
9850
|
}, {
|
9803
9851
|
assign: function(self, value, locals) {
|
9804
|
-
var key =
|
9852
|
+
var key = indexFn(self, locals);
|
9805
9853
|
// prevent overwriting of Function.constructor which would break ensureSafeObject check
|
9806
9854
|
var safe = ensureSafeObject(obj(self, locals), parser.text);
|
9807
9855
|
return safe[key] = value;
|
@@ -10461,7 +10509,7 @@ function $ParseProvider() {
|
|
10461
10509
|
* // Propagate promise resolution to 'then' functions using $apply().
|
10462
10510
|
* $rootScope.$apply();
|
10463
10511
|
* expect(resolvedValue).toEqual(123);
|
10464
|
-
* });
|
10512
|
+
* }));
|
10465
10513
|
* </pre>
|
10466
10514
|
*/
|
10467
10515
|
function $QProvider() {
|
@@ -12278,10 +12326,10 @@ function $SceDelegateProvider() {
|
|
12278
12326
|
*
|
12279
12327
|
* <pre class="prettyprint">
|
12280
12328
|
* <input ng-model="userHtml">
|
12281
|
-
* <div ng-bind-html="
|
12329
|
+
* <div ng-bind-html="userHtml">
|
12282
12330
|
* </pre>
|
12283
12331
|
*
|
12284
|
-
* Notice that `ng-bind-html` is bound to `
|
12332
|
+
* Notice that `ng-bind-html` is bound to `userHtml` controlled by the user. With SCE
|
12285
12333
|
* disabled, this application allows the user to render arbitrary HTML into the DIV.
|
12286
12334
|
* In a more realistic example, one may be rendering user comments, blog articles, etc. via
|
12287
12335
|
* bindings. (HTML is just one example of a context where rendering user controlled input creates
|
@@ -13202,8 +13250,14 @@ function $TimeoutProvider() {
|
|
13202
13250
|
// exactly the behavior needed here. There is little value is mocking these out for this
|
13203
13251
|
// service.
|
13204
13252
|
var urlParsingNode = document.createElement("a");
|
13253
|
+
/*
|
13254
|
+
Matches paths for file protocol on windows,
|
13255
|
+
such as /C:/foo/bar, and captures only /foo/bar.
|
13256
|
+
*/
|
13257
|
+
var windowsFilePathExp = /^\/?.*?:(\/.*)/;
|
13205
13258
|
var originUrl = urlResolve(window.location.href, true);
|
13206
13259
|
|
13260
|
+
|
13207
13261
|
/**
|
13208
13262
|
*
|
13209
13263
|
* Implementation Notes for non-IE browsers
|
@@ -13222,7 +13276,7 @@ var originUrl = urlResolve(window.location.href, true);
|
|
13222
13276
|
* browsers. However, the parsed components will not be set if the URL assigned did not specify
|
13223
13277
|
* them. (e.g. if you assign a.href = "foo", then a.protocol, a.host, etc. will be empty.) We
|
13224
13278
|
* work around that by performing the parsing in a 2nd step by taking a previously normalized
|
13225
|
-
* URL (e.g. by
|
13279
|
+
* URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the
|
13226
13280
|
* properties such as protocol, hostname, port, etc.
|
13227
13281
|
*
|
13228
13282
|
* IE7 does not normalize the URL when assigned to an anchor node. (Apparently, it does, if one
|
@@ -13256,8 +13310,10 @@ var originUrl = urlResolve(window.location.href, true);
|
|
13256
13310
|
* | pathname | The pathname, beginning with "/"
|
13257
13311
|
*
|
13258
13312
|
*/
|
13259
|
-
function urlResolve(url) {
|
13260
|
-
var href = url
|
13313
|
+
function urlResolve(url, base) {
|
13314
|
+
var href = url,
|
13315
|
+
pathname;
|
13316
|
+
|
13261
13317
|
if (msie) {
|
13262
13318
|
// Normalize before parse. Refer Implementation Notes on why this is
|
13263
13319
|
// done in two steps on IE.
|
@@ -13267,7 +13323,22 @@ function urlResolve(url) {
|
|
13267
13323
|
|
13268
13324
|
urlParsingNode.setAttribute('href', href);
|
13269
13325
|
|
13270
|
-
|
13326
|
+
/*
|
13327
|
+
* In Windows, on an anchor node on documents loaded from
|
13328
|
+
* the filesystem, the browser will return a pathname
|
13329
|
+
* prefixed with the drive name ('/C:/path') when a
|
13330
|
+
* pathname without a drive is set:
|
13331
|
+
* * a.setAttribute('href', '/foo')
|
13332
|
+
* * a.pathname === '/C:/foo' //true
|
13333
|
+
*
|
13334
|
+
* Inside of Angular, we're always using pathnames that
|
13335
|
+
* do not include drive names for routing.
|
13336
|
+
*/
|
13337
|
+
|
13338
|
+
pathname = removeWindowsDriveName(urlParsingNode.pathname, url, base);
|
13339
|
+
pathname = (pathname.charAt(0) === '/') ? pathname : '/' + pathname;
|
13340
|
+
|
13341
|
+
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
13271
13342
|
return {
|
13272
13343
|
href: urlParsingNode.href,
|
13273
13344
|
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
@@ -13276,8 +13347,7 @@ function urlResolve(url) {
|
|
13276
13347
|
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
13277
13348
|
hostname: urlParsingNode.hostname,
|
13278
13349
|
port: urlParsingNode.port,
|
13279
|
-
pathname:
|
13280
|
-
urlParsingNode.pathname : '/' + urlParsingNode.pathname
|
13350
|
+
pathname: pathname
|
13281
13351
|
};
|
13282
13352
|
}
|
13283
13353
|
|
@@ -13295,6 +13365,26 @@ function urlIsSameOrigin(requestUrl) {
|
|
13295
13365
|
parsed.host === originUrl.host);
|
13296
13366
|
}
|
13297
13367
|
|
13368
|
+
function removeWindowsDriveName (path, url, base) {
|
13369
|
+
var firstPathSegmentMatch;
|
13370
|
+
|
13371
|
+
//Get the relative path from the input URL.
|
13372
|
+
if (url.indexOf(base) === 0) {
|
13373
|
+
url = url.replace(base, '');
|
13374
|
+
}
|
13375
|
+
|
13376
|
+
/*
|
13377
|
+
* The input URL intentionally contains a
|
13378
|
+
* first path segment that ends with a colon.
|
13379
|
+
*/
|
13380
|
+
if (windowsFilePathExp.exec(url)) {
|
13381
|
+
return path;
|
13382
|
+
}
|
13383
|
+
|
13384
|
+
firstPathSegmentMatch = windowsFilePathExp.exec(path);
|
13385
|
+
return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;
|
13386
|
+
}
|
13387
|
+
|
13298
13388
|
/**
|
13299
13389
|
* @ngdoc object
|
13300
13390
|
* @name ng.$window
|
@@ -14811,7 +14901,7 @@ var nullFormCtrl = {
|
|
14811
14901
|
* @property {Object} $error Is an object hash, containing references to all invalid controls or
|
14812
14902
|
* forms, where:
|
14813
14903
|
*
|
14814
|
-
* - keys are validation tokens (error names) — such as `required`, `url` or `email
|
14904
|
+
* - keys are validation tokens (error names) — such as `required`, `url` or `email`,
|
14815
14905
|
* - values are arrays of controls or forms that are invalid with given error.
|
14816
14906
|
*
|
14817
14907
|
* @description
|
@@ -15996,6 +16086,11 @@ var VALID_CLASS = 'ng-valid',
|
|
15996
16086
|
* }
|
15997
16087
|
* ngModel.$formatters.push(formatter);
|
15998
16088
|
* </pre>
|
16089
|
+
*
|
16090
|
+
* @property {Array.<Function>} $viewChangeListeners Array of functions to execute whenever the
|
16091
|
+
* view value has changed. It is called with no arguments, and its return value is ignored.
|
16092
|
+
* This can be used in place of additional $watches against the model value.
|
16093
|
+
*
|
15999
16094
|
* @property {Object} $error An object hash with all errors as keys.
|
16000
16095
|
*
|
16001
16096
|
* @property {boolean} $pristine True if user has not interacted with the control yet.
|
@@ -16259,14 +16354,19 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
|
|
16259
16354
|
* @methodOf ng.directive:ngModel.NgModelController
|
16260
16355
|
*
|
16261
16356
|
* @description
|
16262
|
-
*
|
16357
|
+
* Update the view value.
|
16263
16358
|
*
|
16264
|
-
* This method should be called from within a DOM event handler.
|
16265
|
-
* For example {@link ng.directive:input input}
|
16359
|
+
* This method should be called when the view value changes, typically from within a DOM event handler.
|
16360
|
+
* For example {@link ng.directive:input input} and
|
16266
16361
|
* {@link ng.directive:select select} directives call it.
|
16267
16362
|
*
|
16268
|
-
* It
|
16269
|
-
*
|
16363
|
+
* It will update the $viewValue, then pass this value through each of the functions in `$parsers`,
|
16364
|
+
* which includes any validators. The value that comes out of this `$parsers` pipeline, be applied to
|
16365
|
+
* `$modelValue` and the **expression** specified in the `ng-model` attribute.
|
16366
|
+
*
|
16367
|
+
* Lastly, all the registered change listeners, in the `$viewChangeListeners` list, are called.
|
16368
|
+
*
|
16369
|
+
* Note that calling this function does not trigger a `$digest`.
|
16270
16370
|
*
|
16271
16371
|
* @param {string} value Value from the view.
|
16272
16372
|
*/
|
@@ -16768,27 +16868,33 @@ var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
|
|
16768
16868
|
* @param {expression} ngBindHtml {@link guide/expression Expression} to evaluate.
|
16769
16869
|
*
|
16770
16870
|
* @example
|
16771
|
-
|
16772
|
-
|
16773
|
-
|
16774
|
-
|
16775
|
-
angular.module('ngBindHtmlExample', ['ngSanitize'])
|
16776
|
-
|
16777
|
-
.controller('ngBindHtmlCtrl', ['$scope', function ngBindHtmlCtrl($scope) {
|
16778
|
-
$scope.myHTML = 'I am an <code>HTML</code>string with <a href="#">links!</a> and other <em>stuff</em>';
|
16779
|
-
}]);
|
16780
|
-
</script>
|
16871
|
+
Try it here: enter text in text box and watch the greeting change.
|
16872
|
+
|
16873
|
+
<example module="ngBindHtmlExample" deps="angular-sanitize.js">
|
16874
|
+
<file name="index.html">
|
16781
16875
|
<div ng-controller="ngBindHtmlCtrl">
|
16782
16876
|
<p ng-bind-html="myHTML"></p>
|
16783
16877
|
</div>
|
16784
|
-
</
|
16785
|
-
|
16878
|
+
</file>
|
16879
|
+
|
16880
|
+
<file name="script.js">
|
16881
|
+
angular.module('ngBindHtmlExample', ['ngSanitize'])
|
16882
|
+
|
16883
|
+
.controller('ngBindHtmlCtrl', ['$scope', function ngBindHtmlCtrl($scope) {
|
16884
|
+
$scope.myHTML =
|
16885
|
+
'I am an <code>HTML</code>string with <a href="#">links!</a> and other <em>stuff</em>';
|
16886
|
+
}]);
|
16887
|
+
</file>
|
16888
|
+
|
16889
|
+
<file name="scenario.js">
|
16786
16890
|
it('should check ng-bind-html', function() {
|
16787
16891
|
expect(using('.doc-example-live').binding('myHTML')).
|
16788
|
-
toBe(
|
16892
|
+
toBe(
|
16893
|
+
'I am an <code>HTML</code>string with <a href="#">links!</a> and other <em>stuff</em>'
|
16894
|
+
);
|
16789
16895
|
});
|
16790
|
-
</
|
16791
|
-
</
|
16896
|
+
</file>
|
16897
|
+
</example>
|
16792
16898
|
*/
|
16793
16899
|
var ngBindHtmlDirective = ['$sce', '$parse', function($sce, $parse) {
|
16794
16900
|
return function(scope, element, attr) {
|
@@ -16901,18 +17007,18 @@ function classDirective(name, selector) {
|
|
16901
17007
|
* @example Example that demonstrates basic bindings via ngClass directive.
|
16902
17008
|
<example>
|
16903
17009
|
<file name="index.html">
|
16904
|
-
<p ng-class="{strike:
|
16905
|
-
<input type="checkbox" ng-model="
|
16906
|
-
<input type="checkbox" ng-model="
|
16907
|
-
<input type="checkbox" ng-model="
|
17010
|
+
<p ng-class="{strike: deleted, bold: important, red: error}">Map Syntax Example</p>
|
17011
|
+
<input type="checkbox" ng-model="deleted"> deleted (apply "strike" class)<br>
|
17012
|
+
<input type="checkbox" ng-model="important"> important (apply "bold" class)<br>
|
17013
|
+
<input type="checkbox" ng-model="error"> error (apply "red" class)
|
16908
17014
|
<hr>
|
16909
17015
|
<p ng-class="style">Using String Syntax</p>
|
16910
17016
|
<input type="text" ng-model="style" placeholder="Type: bold strike red">
|
16911
17017
|
<hr>
|
16912
17018
|
<p ng-class="[style1, style2, style3]">Using Array Syntax</p>
|
16913
|
-
<input ng-model="style1" placeholder="Type: bold"><br>
|
16914
|
-
<input ng-model="style2" placeholder="Type: strike"><br>
|
16915
|
-
<input ng-model="style3" placeholder="Type: red"><br>
|
17019
|
+
<input ng-model="style1" placeholder="Type: bold, strike or red"><br>
|
17020
|
+
<input ng-model="style2" placeholder="Type: bold, strike or red"><br>
|
17021
|
+
<input ng-model="style3" placeholder="Type: bold, strike or red"><br>
|
16916
17022
|
</file>
|
16917
17023
|
<file name="style.css">
|
16918
17024
|
.strike {
|
@@ -16931,10 +17037,10 @@ function classDirective(name, selector) {
|
|
16931
17037
|
expect(element('.doc-example-live p:first').prop('className')).not().toMatch(/bold/);
|
16932
17038
|
expect(element('.doc-example-live p:first').prop('className')).not().toMatch(/red/);
|
16933
17039
|
|
16934
|
-
input('
|
17040
|
+
input('important').check();
|
16935
17041
|
expect(element('.doc-example-live p:first').prop('className')).toMatch(/bold/);
|
16936
17042
|
|
16937
|
-
input('
|
17043
|
+
input('error').check();
|
16938
17044
|
expect(element('.doc-example-live p:first').prop('className')).toMatch(/red/);
|
16939
17045
|
});
|
16940
17046
|
|
@@ -17780,7 +17886,7 @@ forEach(
|
|
17780
17886
|
}
|
17781
17887
|
|
17782
17888
|
/*
|
17783
|
-
The transition styles can also be placed on the CSS base class above
|
17889
|
+
The transition styles can also be placed on the CSS base class above
|
17784
17890
|
*/
|
17785
17891
|
.animate-if.ng-enter, .animate-if.ng-leave {
|
17786
17892
|
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
@@ -17806,22 +17912,21 @@ var ngIfDirective = ['$animate', function($animate) {
|
|
17806
17912
|
terminal: true,
|
17807
17913
|
restrict: 'A',
|
17808
17914
|
$$tlb: true,
|
17809
|
-
|
17810
|
-
return function ($scope, $element, $attr) {
|
17915
|
+
link: function ($scope, $element, $attr, ctrl, $transclude) {
|
17811
17916
|
var block, childScope;
|
17812
17917
|
$scope.$watch($attr.ngIf, function ngIfWatchAction(value) {
|
17813
17918
|
|
17814
17919
|
if (toBoolean(value)) {
|
17815
|
-
|
17816
|
-
|
17817
|
-
|
17818
|
-
|
17819
|
-
|
17820
|
-
|
17821
|
-
|
17822
|
-
|
17823
|
-
|
17824
|
-
|
17920
|
+
if (!childScope) {
|
17921
|
+
childScope = $scope.$new();
|
17922
|
+
$transclude(childScope, function (clone) {
|
17923
|
+
block = {
|
17924
|
+
startNode: clone[0],
|
17925
|
+
endNode: clone[clone.length++] = document.createComment(' end ngIf: ' + $attr.ngIf + ' ')
|
17926
|
+
};
|
17927
|
+
$animate.enter(clone, $element.parent(), $element);
|
17928
|
+
});
|
17929
|
+
}
|
17825
17930
|
} else {
|
17826
17931
|
|
17827
17932
|
if (childScope) {
|
@@ -17835,7 +17940,6 @@ var ngIfDirective = ['$animate', function($animate) {
|
|
17835
17940
|
}
|
17836
17941
|
}
|
17837
17942
|
});
|
17838
|
-
};
|
17839
17943
|
}
|
17840
17944
|
};
|
17841
17945
|
}];
|
@@ -17994,12 +18098,12 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
|
|
17994
18098
|
priority: 400,
|
17995
18099
|
terminal: true,
|
17996
18100
|
transclude: 'element',
|
17997
|
-
compile: function(element, attr
|
18101
|
+
compile: function(element, attr) {
|
17998
18102
|
var srcExp = attr.ngInclude || attr.src,
|
17999
18103
|
onloadExp = attr.onload || '',
|
18000
18104
|
autoScrollExp = attr.autoscroll;
|
18001
18105
|
|
18002
|
-
return function(scope, $element) {
|
18106
|
+
return function(scope, $element, $attr, ctrl, $transclude) {
|
18003
18107
|
var changeCounter = 0,
|
18004
18108
|
currentScope,
|
18005
18109
|
currentElement;
|
@@ -18028,7 +18132,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
|
|
18028
18132
|
if (thisChangeId !== changeCounter) return;
|
18029
18133
|
var newScope = scope.$new();
|
18030
18134
|
|
18031
|
-
|
18135
|
+
$transclude(newScope, function(clone) {
|
18032
18136
|
cleanupLastIncludeContent();
|
18033
18137
|
|
18034
18138
|
currentScope = newScope;
|
@@ -18557,8 +18661,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
|
|
18557
18661
|
priority: 1000,
|
18558
18662
|
terminal: true,
|
18559
18663
|
$$tlb: true,
|
18560
|
-
|
18561
|
-
return function($scope, $element, $attr){
|
18664
|
+
link: function($scope, $element, $attr, ctrl, $transclude){
|
18562
18665
|
var expression = $attr.ngRepeat;
|
18563
18666
|
var match = expression.match(/^\s*(.+)\s+in\s+(.*?)\s*(\s+track\s+by\s+(.+)\s*)?$/),
|
18564
18667
|
trackByExp, trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn,
|
@@ -18720,7 +18823,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
|
|
18720
18823
|
// jshint bitwise: true
|
18721
18824
|
|
18722
18825
|
if (!block.startNode) {
|
18723
|
-
|
18826
|
+
$transclude(childScope, function(clone) {
|
18724
18827
|
clone[clone.length++] = document.createComment(' end ngRepeat: ' + expression + ' ');
|
18725
18828
|
$animate.enter(clone, null, jqLite(previousNode));
|
18726
18829
|
previousNode = clone;
|
@@ -18733,7 +18836,6 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
|
|
18733
18836
|
}
|
18734
18837
|
lastBlockMap = nextBlockMap;
|
18735
18838
|
});
|
18736
|
-
};
|
18737
18839
|
}
|
18738
18840
|
};
|
18739
18841
|
}];
|
@@ -19242,10 +19344,10 @@ var ngSwitchWhenDirective = ngDirective({
|
|
19242
19344
|
transclude: 'element',
|
19243
19345
|
priority: 800,
|
19244
19346
|
require: '^ngSwitch',
|
19245
|
-
compile: function(element, attrs
|
19246
|
-
return function(scope, element, attr, ctrl) {
|
19347
|
+
compile: function(element, attrs) {
|
19348
|
+
return function(scope, element, attr, ctrl, $transclude) {
|
19247
19349
|
ctrl.cases['!' + attrs.ngSwitchWhen] = (ctrl.cases['!' + attrs.ngSwitchWhen] || []);
|
19248
|
-
ctrl.cases['!' + attrs.ngSwitchWhen].push({ transclude: transclude, element: element });
|
19350
|
+
ctrl.cases['!' + attrs.ngSwitchWhen].push({ transclude: $transclude, element: element });
|
19249
19351
|
};
|
19250
19352
|
}
|
19251
19353
|
});
|
@@ -19254,12 +19356,10 @@ var ngSwitchDefaultDirective = ngDirective({
|
|
19254
19356
|
transclude: 'element',
|
19255
19357
|
priority: 800,
|
19256
19358
|
require: '^ngSwitch',
|
19257
|
-
|
19258
|
-
|
19259
|
-
|
19260
|
-
|
19261
|
-
};
|
19262
|
-
}
|
19359
|
+
link: function(scope, element, attr, ctrl, $transclude) {
|
19360
|
+
ctrl.cases['?'] = (ctrl.cases['?'] || []);
|
19361
|
+
ctrl.cases['?'].push({ transclude: $transclude, element: element });
|
19362
|
+
}
|
19263
19363
|
});
|
19264
19364
|
|
19265
19365
|
/**
|