angularjs-rails 1.2.19 → 1.2.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/angularjs-rails/version.rb +2 -2
- data/vendor/assets/javascripts/angular-animate.js +75 -19
- data/vendor/assets/javascripts/angular-cookies.js +17 -15
- data/vendor/assets/javascripts/angular-loader.js +2 -2
- data/vendor/assets/javascripts/angular-mocks.js +1 -1
- data/vendor/assets/javascripts/angular-resource.js +1 -1
- data/vendor/assets/javascripts/angular-route.js +1 -1
- data/vendor/assets/javascripts/angular-sanitize.js +25 -23
- data/vendor/assets/javascripts/angular-scenario.js +505 -461
- data/vendor/assets/javascripts/angular-touch.js +1 -1
- data/vendor/assets/javascripts/angular.js +505 -461
- data/vendor/assets/javascripts/unstable/angular-animate.js +118 -41
- data/vendor/assets/javascripts/unstable/angular-cookies.js +17 -15
- data/vendor/assets/javascripts/unstable/angular-loader.js +2 -2
- data/vendor/assets/javascripts/unstable/angular-messages.js +1 -1
- data/vendor/assets/javascripts/unstable/angular-mocks.js +2 -2
- data/vendor/assets/javascripts/unstable/angular-resource.js +1 -1
- data/vendor/assets/javascripts/unstable/angular-route.js +1 -1
- data/vendor/assets/javascripts/unstable/angular-sanitize.js +25 -23
- data/vendor/assets/javascripts/unstable/angular-scenario.js +980 -759
- data/vendor/assets/javascripts/unstable/angular-touch.js +1 -1
- data/vendor/assets/javascripts/unstable/angular.js +980 -759
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c4bf4ceba404ee9290e2ea88558badc93abc014
|
4
|
+
data.tar.gz: 3cc597cb2ae8b9cebbf812cc467760019e9d043b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32d4690d0e7a7e7b6cdfd042d1786e58f60d7ff187999ba72c3449974b4e00f1d85b2bedaf659a44492dff62ee1cd4a6e7fe1360d31b47a879968cebdf20d099
|
7
|
+
data.tar.gz: 0951e4ecd0101b7c46192a61879642e3d807a253af6e4afe2a1000d32c591d3eea9d148fb4cb52579c93486107977513aa6734d27e0d9fc9bfc44e87194cd8da
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.20
|
3
3
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -64,8 +64,22 @@
|
|
64
64
|
* <ANY class="slide" ng-include="..."></ANY>
|
65
65
|
* ```
|
66
66
|
*
|
67
|
-
* Keep in mind that if an animation is running, any child elements cannot be animated
|
68
|
-
* animation has completed.
|
67
|
+
* Keep in mind that, by default, if an animation is running, any child elements cannot be animated
|
68
|
+
* until the parent element's animation has completed. This blocking feature can be overridden by
|
69
|
+
* placing the `ng-animate-children` attribute on a parent container tag.
|
70
|
+
*
|
71
|
+
* ```html
|
72
|
+
* <div class="slide-animation" ng-if="on" ng-animate-children>
|
73
|
+
* <div class="fade-animation" ng-if="on">
|
74
|
+
* <div class="explode-animation" ng-if="on">
|
75
|
+
* ...
|
76
|
+
* </div>
|
77
|
+
* </div>
|
78
|
+
* </div>
|
79
|
+
* ```
|
80
|
+
*
|
81
|
+
* When the `on` expression value changes and an animation is triggered then each of the elements within
|
82
|
+
* will all animate without the block being applied to child elements.
|
69
83
|
*
|
70
84
|
* <h2>CSS-defined Animations</h2>
|
71
85
|
* The animate service will automatically apply two CSS classes to the animated element and these two CSS classes
|
@@ -255,6 +269,19 @@ angular.module('ngAnimate', ['ng'])
|
|
255
269
|
* Please visit the {@link ngAnimate `ngAnimate`} module overview page learn more about how to use animations in your application.
|
256
270
|
*
|
257
271
|
*/
|
272
|
+
.directive('ngAnimateChildren', function() {
|
273
|
+
var NG_ANIMATE_CHILDREN = '$$ngAnimateChildren';
|
274
|
+
return function(scope, element, attrs) {
|
275
|
+
var val = attrs.ngAnimateChildren;
|
276
|
+
if(angular.isString(val) && val.length === 0) { //empty attribute
|
277
|
+
element.data(NG_ANIMATE_CHILDREN, true);
|
278
|
+
} else {
|
279
|
+
scope.$watch(val, function(value) {
|
280
|
+
element.data(NG_ANIMATE_CHILDREN, !!value);
|
281
|
+
});
|
282
|
+
}
|
283
|
+
};
|
284
|
+
})
|
258
285
|
|
259
286
|
//this private service is only used within CSS-enabled animations
|
260
287
|
//IE8 + IE9 do not support rAF natively, but that is fine since they
|
@@ -283,6 +310,7 @@ angular.module('ngAnimate', ['ng'])
|
|
283
310
|
|
284
311
|
var ELEMENT_NODE = 1;
|
285
312
|
var NG_ANIMATE_STATE = '$$ngAnimateState';
|
313
|
+
var NG_ANIMATE_CHILDREN = '$$ngAnimateChildren';
|
286
314
|
var NG_ANIMATE_CLASS_NAME = 'ng-animate';
|
287
315
|
var rootAnimateState = {running: true};
|
288
316
|
|
@@ -332,6 +360,12 @@ angular.module('ngAnimate', ['ng'])
|
|
332
360
|
return classNameFilter.test(className);
|
333
361
|
};
|
334
362
|
|
363
|
+
function blockElementAnimations(element) {
|
364
|
+
var data = element.data(NG_ANIMATE_STATE) || {};
|
365
|
+
data.running = true;
|
366
|
+
element.data(NG_ANIMATE_STATE, data);
|
367
|
+
}
|
368
|
+
|
335
369
|
function lookup(name) {
|
336
370
|
if (name) {
|
337
371
|
var matches = [],
|
@@ -558,7 +592,7 @@ angular.module('ngAnimate', ['ng'])
|
|
558
592
|
parentElement = prepareElement(parentElement);
|
559
593
|
afterElement = prepareElement(afterElement);
|
560
594
|
|
561
|
-
|
595
|
+
blockElementAnimations(element);
|
562
596
|
$delegate.enter(element, parentElement, afterElement);
|
563
597
|
$rootScope.$$postDigest(function() {
|
564
598
|
element = stripCommentsFromElement(element);
|
@@ -596,7 +630,7 @@ angular.module('ngAnimate', ['ng'])
|
|
596
630
|
leave : function(element, doneCallback) {
|
597
631
|
element = angular.element(element);
|
598
632
|
cancelChildAnimations(element);
|
599
|
-
|
633
|
+
blockElementAnimations(element);
|
600
634
|
$rootScope.$$postDigest(function() {
|
601
635
|
performAnimation('leave', 'ng-leave', stripCommentsFromElement(element), null, null, function() {
|
602
636
|
$delegate.leave(element);
|
@@ -640,7 +674,7 @@ angular.module('ngAnimate', ['ng'])
|
|
640
674
|
afterElement = prepareElement(afterElement);
|
641
675
|
|
642
676
|
cancelChildAnimations(element);
|
643
|
-
|
677
|
+
blockElementAnimations(element);
|
644
678
|
$delegate.move(element, parentElement, afterElement);
|
645
679
|
$rootScope.$$postDigest(function() {
|
646
680
|
element = stripCommentsFromElement(element);
|
@@ -814,9 +848,12 @@ angular.module('ngAnimate', ['ng'])
|
|
814
848
|
|
815
849
|
//only allow animations if the currently running animation is not structural
|
816
850
|
//or if there is no animation running at all
|
817
|
-
var skipAnimations
|
818
|
-
|
819
|
-
|
851
|
+
var skipAnimations;
|
852
|
+
if (runner.isClassBased) {
|
853
|
+
skipAnimations = ngAnimateState.running ||
|
854
|
+
ngAnimateState.disabled ||
|
855
|
+
(lastAnimation && !lastAnimation.isClassBased);
|
856
|
+
}
|
820
857
|
|
821
858
|
//skip the animation if animations are disabled, a parent is already being animated,
|
822
859
|
//the element is not currently attached to the document body or then completely close
|
@@ -1033,30 +1070,49 @@ angular.module('ngAnimate', ['ng'])
|
|
1033
1070
|
}
|
1034
1071
|
|
1035
1072
|
function animationsDisabled(element, parentElement) {
|
1036
|
-
if (rootAnimateState.disabled)
|
1073
|
+
if (rootAnimateState.disabled) {
|
1074
|
+
return true;
|
1075
|
+
}
|
1037
1076
|
|
1038
|
-
if(isMatchingElement(element, $rootElement)) {
|
1039
|
-
return rootAnimateState.
|
1077
|
+
if (isMatchingElement(element, $rootElement)) {
|
1078
|
+
return rootAnimateState.running;
|
1040
1079
|
}
|
1041
1080
|
|
1081
|
+
var allowChildAnimations, parentRunningAnimation, hasParent;
|
1042
1082
|
do {
|
1043
1083
|
//the element did not reach the root element which means that it
|
1044
1084
|
//is not apart of the DOM. Therefore there is no reason to do
|
1045
1085
|
//any animations on it
|
1046
|
-
if(parentElement.length === 0) break;
|
1086
|
+
if (parentElement.length === 0) break;
|
1047
1087
|
|
1048
1088
|
var isRoot = isMatchingElement(parentElement, $rootElement);
|
1049
|
-
var state = isRoot ? rootAnimateState : parentElement.data(NG_ANIMATE_STATE);
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1089
|
+
var state = isRoot ? rootAnimateState : (parentElement.data(NG_ANIMATE_STATE) || {});
|
1090
|
+
if (state.disabled) {
|
1091
|
+
return true;
|
1092
|
+
}
|
1093
|
+
|
1094
|
+
//no matter what, for an animation to work it must reach the root element
|
1095
|
+
//this implies that the element is attached to the DOM when the animation is run
|
1096
|
+
if (isRoot) {
|
1097
|
+
hasParent = true;
|
1053
1098
|
}
|
1054
1099
|
|
1055
|
-
|
1100
|
+
//once a flag is found that is strictly false then everything before
|
1101
|
+
//it will be discarded and all child animations will be restricted
|
1102
|
+
if (allowChildAnimations !== false) {
|
1103
|
+
var animateChildrenFlag = parentElement.data(NG_ANIMATE_CHILDREN);
|
1104
|
+
if(angular.isDefined(animateChildrenFlag)) {
|
1105
|
+
allowChildAnimations = animateChildrenFlag;
|
1106
|
+
}
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
parentRunningAnimation = parentRunningAnimation ||
|
1110
|
+
state.running ||
|
1111
|
+
(state.last && !state.last.isClassBased);
|
1056
1112
|
}
|
1057
1113
|
while(parentElement = parentElement.parent());
|
1058
1114
|
|
1059
|
-
return
|
1115
|
+
return !hasParent || (!allowChildAnimations && parentRunningAnimation);
|
1060
1116
|
}
|
1061
1117
|
}]);
|
1062
1118
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.20
|
3
3
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -39,12 +39,13 @@ angular.module('ngCookies', ['ng']).
|
|
39
39
|
* @example
|
40
40
|
*
|
41
41
|
* ```js
|
42
|
-
*
|
43
|
-
*
|
44
|
-
*
|
45
|
-
*
|
46
|
-
*
|
47
|
-
*
|
42
|
+
* angular.module('cookiesExample', ['ngCookies'])
|
43
|
+
* .controller('ExampleController', ['$cookies', function($cookies) {
|
44
|
+
* // Retrieving a cookie
|
45
|
+
* var favoriteCookie = $cookies.myFavorite;
|
46
|
+
* // Setting a cookie
|
47
|
+
* $cookies.myFavorite = 'oatmeal';
|
48
|
+
* }]);
|
48
49
|
* ```
|
49
50
|
*/
|
50
51
|
factory('$cookies', ['$rootScope', '$browser', function ($rootScope, $browser) {
|
@@ -142,14 +143,15 @@ angular.module('ngCookies', ['ng']).
|
|
142
143
|
* @example
|
143
144
|
*
|
144
145
|
* ```js
|
145
|
-
*
|
146
|
-
*
|
147
|
-
*
|
148
|
-
*
|
149
|
-
*
|
150
|
-
*
|
151
|
-
*
|
152
|
-
*
|
146
|
+
* angular.module('cookieStoreExample', ['ngCookies'])
|
147
|
+
* .controller('ExampleController', ['$cookieStore', function($cookieStore) {
|
148
|
+
* // Put cookie
|
149
|
+
* $cookieStore.put('myFavorite','oatmeal');
|
150
|
+
* // Get cookie
|
151
|
+
* var favoriteCookie = $cookieStore.get('myFavorite');
|
152
|
+
* // Removing a cookie
|
153
|
+
* $cookieStore.remove('myFavorite');
|
154
|
+
* }]);
|
153
155
|
* ```
|
154
156
|
*/
|
155
157
|
factory('$cookieStore', ['$cookies', function($cookies) {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.20
|
3
3
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -69,7 +69,7 @@ function minErr(module) {
|
|
69
69
|
return match;
|
70
70
|
});
|
71
71
|
|
72
|
-
message = message + '\nhttp://errors.angularjs.org/1.2.
|
72
|
+
message = message + '\nhttp://errors.angularjs.org/1.2.20/' +
|
73
73
|
(module ? module + '/' : '') + code;
|
74
74
|
for (i = 2; i < arguments.length; i++) {
|
75
75
|
message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.20
|
3
3
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -57,20 +57,21 @@ var $sanitizeMinErr = angular.$$minErr('$sanitize');
|
|
57
57
|
* @returns {string} Sanitized html.
|
58
58
|
*
|
59
59
|
* @example
|
60
|
-
<example module="
|
60
|
+
<example module="sanitizeExample" deps="angular-sanitize.js">
|
61
61
|
<file name="index.html">
|
62
62
|
<script>
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
63
|
+
angular.module('sanitizeExample', ['ngSanitize'])
|
64
|
+
.controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {
|
65
|
+
$scope.snippet =
|
66
|
+
'<p style="color:blue">an html\n' +
|
67
|
+
'<em onmouseover="this.textContent=\'PWN3D!\'">click here</em>\n' +
|
68
|
+
'snippet</p>';
|
69
|
+
$scope.deliberatelyTrustDangerousSnippet = function() {
|
70
|
+
return $sce.trustAsHtml($scope.snippet);
|
71
|
+
};
|
72
|
+
}]);
|
72
73
|
</script>
|
73
|
-
<div ng-controller="
|
74
|
+
<div ng-controller="ExampleController">
|
74
75
|
Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
|
75
76
|
<table>
|
76
77
|
<tr>
|
@@ -498,20 +499,21 @@ angular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);
|
|
498
499
|
<span ng-bind-html="linky_expression | linky"></span>
|
499
500
|
*
|
500
501
|
* @example
|
501
|
-
<example module="
|
502
|
+
<example module="linkyExample" deps="angular-sanitize.js">
|
502
503
|
<file name="index.html">
|
503
504
|
<script>
|
504
|
-
|
505
|
-
$scope
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
505
|
+
angular.module('linkyExample', ['ngSanitize'])
|
506
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
507
|
+
$scope.snippet =
|
508
|
+
'Pretty text with some links:\n'+
|
509
|
+
'http://angularjs.org/,\n'+
|
510
|
+
'mailto:us@somewhere.org,\n'+
|
511
|
+
'another@somewhere.org,\n'+
|
512
|
+
'and one more: ftp://127.0.0.1/.';
|
513
|
+
$scope.snippetWithTarget = 'http://angularjs.org/';
|
514
|
+
}]);
|
513
515
|
</script>
|
514
|
-
<div ng-controller="
|
516
|
+
<div ng-controller="ExampleController">
|
515
517
|
Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
|
516
518
|
<table>
|
517
519
|
<tr>
|
@@ -9790,7 +9790,7 @@ if ( typeof module === "object" && module && typeof module.exports === "object"
|
|
9790
9790
|
})( window );
|
9791
9791
|
|
9792
9792
|
/**
|
9793
|
-
* @license AngularJS v1.2.
|
9793
|
+
* @license AngularJS v1.2.20
|
9794
9794
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
9795
9795
|
* License: MIT
|
9796
9796
|
*/
|
@@ -9860,7 +9860,7 @@ function minErr(module) {
|
|
9860
9860
|
return match;
|
9861
9861
|
});
|
9862
9862
|
|
9863
|
-
message = message + '\nhttp://errors.angularjs.org/1.2.
|
9863
|
+
message = message + '\nhttp://errors.angularjs.org/1.2.20/' +
|
9864
9864
|
(module ? module + '/' : '') + code;
|
9865
9865
|
for (i = 2; i < arguments.length; i++) {
|
9866
9866
|
message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
|
@@ -10602,9 +10602,9 @@ function isLeafNode (node) {
|
|
10602
10602
|
* @returns {*} The copy or updated `destination`, if `destination` was specified.
|
10603
10603
|
*
|
10604
10604
|
* @example
|
10605
|
-
<example>
|
10605
|
+
<example module="copyExample">
|
10606
10606
|
<file name="index.html">
|
10607
|
-
<div ng-controller="
|
10607
|
+
<div ng-controller="ExampleController">
|
10608
10608
|
<form novalidate class="simple-form">
|
10609
10609
|
Name: <input type="text" ng-model="user.name" /><br />
|
10610
10610
|
E-mail: <input type="email" ng-model="user.email" /><br />
|
@@ -10618,21 +10618,22 @@ function isLeafNode (node) {
|
|
10618
10618
|
</div>
|
10619
10619
|
|
10620
10620
|
<script>
|
10621
|
-
|
10622
|
-
$scope
|
10621
|
+
angular.module('copyExample')
|
10622
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
10623
|
+
$scope.master= {};
|
10623
10624
|
|
10624
|
-
|
10625
|
-
|
10626
|
-
|
10627
|
-
|
10625
|
+
$scope.update = function(user) {
|
10626
|
+
// Example with 1 argument
|
10627
|
+
$scope.master= angular.copy(user);
|
10628
|
+
};
|
10628
10629
|
|
10629
|
-
|
10630
|
-
|
10631
|
-
|
10632
|
-
|
10630
|
+
$scope.reset = function() {
|
10631
|
+
// Example with 2 arguments
|
10632
|
+
angular.copy($scope.master, $scope.user);
|
10633
|
+
};
|
10633
10634
|
|
10634
|
-
|
10635
|
-
|
10635
|
+
$scope.reset();
|
10636
|
+
}]);
|
10636
10637
|
</script>
|
10637
10638
|
</file>
|
10638
10639
|
</example>
|
@@ -10976,7 +10977,7 @@ function parseKeyValue(/**string*/keyValue) {
|
|
10976
10977
|
key = tryDecodeURIComponent(key_value[0]);
|
10977
10978
|
if ( isDefined(key) ) {
|
10978
10979
|
var val = isDefined(key_value[1]) ? tryDecodeURIComponent(key_value[1]) : true;
|
10979
|
-
if (!obj
|
10980
|
+
if (!hasOwnProperty.call(obj, key)) {
|
10980
10981
|
obj[key] = val;
|
10981
10982
|
} else if(isArray(obj[key])) {
|
10982
10983
|
obj[key].push(val);
|
@@ -11750,11 +11751,11 @@ function setupModuleLoader(window) {
|
|
11750
11751
|
* - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
|
11751
11752
|
*/
|
11752
11753
|
var version = {
|
11753
|
-
full: '1.2.
|
11754
|
+
full: '1.2.20', // all of these placeholder strings will be replaced by grunt's
|
11754
11755
|
major: 1, // package task
|
11755
11756
|
minor: 2,
|
11756
|
-
dot:
|
11757
|
-
codeName: '
|
11757
|
+
dot: 20,
|
11758
|
+
codeName: 'accidental-beautification'
|
11758
11759
|
};
|
11759
11760
|
|
11760
11761
|
|
@@ -15033,7 +15034,7 @@ function $TemplateCacheProvider() {
|
|
15033
15034
|
* local name. Given `<widget my-attr="count = count + value">` and widget definition of
|
15034
15035
|
* `scope: { localFn:'&myAttr' }`, then isolate scope property `localFn` will point to
|
15035
15036
|
* a function wrapper for the `count = count + value` expression. Often it's desirable to
|
15036
|
-
* pass data from the isolated scope via an expression
|
15037
|
+
* pass data from the isolated scope via an expression to the parent scope, this can be
|
15037
15038
|
* done by passing a map of local variable names and values into the expression wrapper fn.
|
15038
15039
|
* For example, if the expression is `increment(amount)` then we can specify the amount value
|
15039
15040
|
* by calling the `localFn` as `localFn({amount: 22})`.
|
@@ -15260,10 +15261,10 @@ function $TemplateCacheProvider() {
|
|
15260
15261
|
* to illustrate how `$compile` works.
|
15261
15262
|
* </div>
|
15262
15263
|
*
|
15263
|
-
<example module="
|
15264
|
+
<example module="compileExample">
|
15264
15265
|
<file name="index.html">
|
15265
15266
|
<script>
|
15266
|
-
angular.module('
|
15267
|
+
angular.module('compileExample', [], function($compileProvider) {
|
15267
15268
|
// configure new 'compile' directive by passing a directive
|
15268
15269
|
// factory function. The factory function injects the '$compile'
|
15269
15270
|
$compileProvider.directive('compile', function($compile) {
|
@@ -15287,15 +15288,14 @@ function $TemplateCacheProvider() {
|
|
15287
15288
|
}
|
15288
15289
|
);
|
15289
15290
|
};
|
15290
|
-
})
|
15291
|
-
})
|
15292
|
-
|
15293
|
-
function Ctrl($scope) {
|
15291
|
+
});
|
15292
|
+
})
|
15293
|
+
.controller('GreeterController', ['$scope', function($scope) {
|
15294
15294
|
$scope.name = 'Angular';
|
15295
15295
|
$scope.html = 'Hello {{name}}';
|
15296
|
-
}
|
15296
|
+
}]);
|
15297
15297
|
</script>
|
15298
|
-
<div ng-controller="
|
15298
|
+
<div ng-controller="GreeterController">
|
15299
15299
|
<input ng-model="name"> <br>
|
15300
15300
|
<textarea ng-model="html"></textarea> <br>
|
15301
15301
|
<div compile="html"></div>
|
@@ -17031,18 +17031,19 @@ function $ControllerProvider() {
|
|
17031
17031
|
* A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object.
|
17032
17032
|
*
|
17033
17033
|
* @example
|
17034
|
-
<example>
|
17034
|
+
<example module="documentExample">
|
17035
17035
|
<file name="index.html">
|
17036
|
-
<div ng-controller="
|
17036
|
+
<div ng-controller="ExampleController">
|
17037
17037
|
<p>$document title: <b ng-bind="title"></b></p>
|
17038
17038
|
<p>window.document title: <b ng-bind="windowTitle"></b></p>
|
17039
17039
|
</div>
|
17040
17040
|
</file>
|
17041
17041
|
<file name="script.js">
|
17042
|
-
|
17043
|
-
$scope
|
17044
|
-
|
17045
|
-
|
17042
|
+
angular.module('documentExample', [])
|
17043
|
+
.controller('ExampleController', ['$scope', '$document', function($scope, $document) {
|
17044
|
+
$scope.title = $document[0].title;
|
17045
|
+
$scope.windowTitle = angular.element(window.document)[0].title;
|
17046
|
+
}]);
|
17046
17047
|
</file>
|
17047
17048
|
</example>
|
17048
17049
|
*/
|
@@ -17175,12 +17176,39 @@ function isSuccess(status) {
|
|
17175
17176
|
}
|
17176
17177
|
|
17177
17178
|
|
17179
|
+
/**
|
17180
|
+
* @ngdoc provider
|
17181
|
+
* @name $httpProvider
|
17182
|
+
* @description
|
17183
|
+
* Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service.
|
17184
|
+
* */
|
17178
17185
|
function $HttpProvider() {
|
17179
17186
|
var JSON_START = /^\s*(\[|\{[^\{])/,
|
17180
17187
|
JSON_END = /[\}\]]\s*$/,
|
17181
17188
|
PROTECTION_PREFIX = /^\)\]\}',?\n/,
|
17182
17189
|
CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': 'application/json;charset=utf-8'};
|
17183
17190
|
|
17191
|
+
/**
|
17192
|
+
* @ngdoc property
|
17193
|
+
* @name $httpProvider#defaults
|
17194
|
+
* @description
|
17195
|
+
*
|
17196
|
+
* Object containing default values for all {@link ng.$http $http} requests.
|
17197
|
+
*
|
17198
|
+
* - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.
|
17199
|
+
* Defaults value is `'XSRF-TOKEN'`.
|
17200
|
+
*
|
17201
|
+
* - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the
|
17202
|
+
* XSRF token. Defaults value is `'X-XSRF-TOKEN'`.
|
17203
|
+
*
|
17204
|
+
* - **`defaults.headers`** - {Object} - Default headers for all $http requests.
|
17205
|
+
* Refer to {@link ng.$http#setting-http-headers $http} for documentation on
|
17206
|
+
* setting default headers.
|
17207
|
+
* - **`defaults.headers.common`**
|
17208
|
+
* - **`defaults.headers.post`**
|
17209
|
+
* - **`defaults.headers.put`**
|
17210
|
+
* - **`defaults.headers.patch`**
|
17211
|
+
**/
|
17184
17212
|
var defaults = this.defaults = {
|
17185
17213
|
// transform incoming response data
|
17186
17214
|
transformResponse: [function(data) {
|
@@ -17670,9 +17698,9 @@ function $HttpProvider() {
|
|
17670
17698
|
*
|
17671
17699
|
*
|
17672
17700
|
* @example
|
17673
|
-
<example>
|
17701
|
+
<example module="httpExample">
|
17674
17702
|
<file name="index.html">
|
17675
|
-
<div ng-controller="
|
17703
|
+
<div ng-controller="FetchController">
|
17676
17704
|
<select ng-model="method">
|
17677
17705
|
<option>GET</option>
|
17678
17706
|
<option>JSONP</option>
|
@@ -17694,30 +17722,32 @@ function $HttpProvider() {
|
|
17694
17722
|
</div>
|
17695
17723
|
</file>
|
17696
17724
|
<file name="script.js">
|
17697
|
-
|
17698
|
-
$scope
|
17699
|
-
|
17700
|
-
|
17701
|
-
|
17702
|
-
|
17703
|
-
|
17704
|
-
|
17705
|
-
|
17706
|
-
|
17707
|
-
$scope.
|
17708
|
-
|
17709
|
-
|
17710
|
-
|
17711
|
-
|
17712
|
-
|
17713
|
-
|
17714
|
-
|
17725
|
+
angular.module('httpExample', [])
|
17726
|
+
.controller('FetchController', ['$scope', '$http', '$templateCache',
|
17727
|
+
function($scope, $http, $templateCache) {
|
17728
|
+
$scope.method = 'GET';
|
17729
|
+
$scope.url = 'http-hello.html';
|
17730
|
+
|
17731
|
+
$scope.fetch = function() {
|
17732
|
+
$scope.code = null;
|
17733
|
+
$scope.response = null;
|
17734
|
+
|
17735
|
+
$http({method: $scope.method, url: $scope.url, cache: $templateCache}).
|
17736
|
+
success(function(data, status) {
|
17737
|
+
$scope.status = status;
|
17738
|
+
$scope.data = data;
|
17739
|
+
}).
|
17740
|
+
error(function(data, status) {
|
17741
|
+
$scope.data = data || "Request failed";
|
17742
|
+
$scope.status = status;
|
17743
|
+
});
|
17744
|
+
};
|
17715
17745
|
|
17716
|
-
|
17717
|
-
|
17718
|
-
|
17719
|
-
|
17720
|
-
|
17746
|
+
$scope.updateModel = function(method, url) {
|
17747
|
+
$scope.method = method;
|
17748
|
+
$scope.url = url;
|
17749
|
+
};
|
17750
|
+
}]);
|
17721
17751
|
</file>
|
17722
17752
|
<file name="http-hello.html">
|
17723
17753
|
Hello, $http!
|
@@ -17771,7 +17801,7 @@ function $HttpProvider() {
|
|
17771
17801
|
var reqData = transformData(config.data, headersGetter(headers), config.transformRequest);
|
17772
17802
|
|
17773
17803
|
// strip content-type if data is undefined
|
17774
|
-
if (isUndefined(
|
17804
|
+
if (isUndefined(reqData)) {
|
17775
17805
|
forEach(headers, function(value, header) {
|
17776
17806
|
if (lowercase(header) === 'content-type') {
|
17777
17807
|
delete headers[header];
|
@@ -17840,10 +17870,6 @@ function $HttpProvider() {
|
|
17840
17870
|
|
17841
17871
|
defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]);
|
17842
17872
|
|
17843
|
-
// execute if header value is function
|
17844
|
-
execHeaders(defHeaders);
|
17845
|
-
execHeaders(reqHeaders);
|
17846
|
-
|
17847
17873
|
// using for-in instead of forEach to avoid unecessary iteration after header has been found
|
17848
17874
|
defaultHeadersIteration:
|
17849
17875
|
for (defHeaderName in defHeaders) {
|
@@ -17858,6 +17884,8 @@ function $HttpProvider() {
|
|
17858
17884
|
reqHeaders[defHeaderName] = defHeaders[defHeaderName];
|
17859
17885
|
}
|
17860
17886
|
|
17887
|
+
// execute if header value is a function for merged headers
|
17888
|
+
execHeaders(reqHeaders);
|
17861
17889
|
return reqHeaders;
|
17862
17890
|
|
17863
17891
|
function execHeaders(headers) {
|
@@ -18633,25 +18661,27 @@ function $IntervalProvider() {
|
|
18633
18661
|
* @returns {promise} A promise which will be notified on each iteration.
|
18634
18662
|
*
|
18635
18663
|
* @example
|
18636
|
-
* <example module="
|
18637
|
-
*
|
18638
|
-
*
|
18639
|
-
*
|
18640
|
-
*
|
18641
|
-
* $scope
|
18642
|
-
*
|
18664
|
+
* <example module="intervalExample">
|
18665
|
+
* <file name="index.html">
|
18666
|
+
* <script>
|
18667
|
+
* angular.module('intervalExample', [])
|
18668
|
+
* .controller('ExampleController', ['$scope', '$interval',
|
18669
|
+
* function($scope, $interval) {
|
18670
|
+
* $scope.format = 'M/d/yy h:mm:ss a';
|
18671
|
+
* $scope.blood_1 = 100;
|
18672
|
+
* $scope.blood_2 = 120;
|
18643
18673
|
*
|
18644
|
-
*
|
18645
|
-
*
|
18646
|
-
*
|
18647
|
-
*
|
18674
|
+
* var stop;
|
18675
|
+
* $scope.fight = function() {
|
18676
|
+
* // Don't start a new fight if we are already fighting
|
18677
|
+
* if ( angular.isDefined(stop) ) return;
|
18648
18678
|
*
|
18649
18679
|
* stop = $interval(function() {
|
18650
18680
|
* if ($scope.blood_1 > 0 && $scope.blood_2 > 0) {
|
18651
|
-
*
|
18652
|
-
*
|
18681
|
+
* $scope.blood_1 = $scope.blood_1 - 3;
|
18682
|
+
* $scope.blood_2 = $scope.blood_2 - 4;
|
18653
18683
|
* } else {
|
18654
|
-
*
|
18684
|
+
* $scope.stopFight();
|
18655
18685
|
* }
|
18656
18686
|
* }, 100);
|
18657
18687
|
* };
|
@@ -18666,22 +18696,21 @@ function $IntervalProvider() {
|
|
18666
18696
|
* $scope.resetFight = function() {
|
18667
18697
|
* $scope.blood_1 = 100;
|
18668
18698
|
* $scope.blood_2 = 120;
|
18669
|
-
* }
|
18699
|
+
* };
|
18670
18700
|
*
|
18671
18701
|
* $scope.$on('$destroy', function() {
|
18672
|
-
* // Make sure that the interval
|
18702
|
+
* // Make sure that the interval nis destroyed too
|
18673
18703
|
* $scope.stopFight();
|
18674
18704
|
* });
|
18675
|
-
* }
|
18676
|
-
*
|
18677
|
-
*
|
18678
|
-
*
|
18679
|
-
*
|
18680
|
-
* .directive('myCurrentTime', function($interval, dateFilter) {
|
18705
|
+
* })
|
18706
|
+
* // Register the 'myCurrentTime' directive factory method.
|
18707
|
+
* // We inject $interval and dateFilter service since the factory method is DI.
|
18708
|
+
* .directive('myCurrentTime', ['$interval', 'dateFilter',
|
18709
|
+
* function($interval, dateFilter) {
|
18681
18710
|
* // return the directive link function. (compile function not needed)
|
18682
18711
|
* return function(scope, element, attrs) {
|
18683
18712
|
* var format, // date format
|
18684
|
-
*
|
18713
|
+
* stopTime; // so that we can cancel the time updates
|
18685
18714
|
*
|
18686
18715
|
* // used to update the UI
|
18687
18716
|
* function updateTime() {
|
@@ -18697,28 +18726,28 @@ function $IntervalProvider() {
|
|
18697
18726
|
* stopTime = $interval(updateTime, 1000);
|
18698
18727
|
*
|
18699
18728
|
* // listen on DOM destroy (removal) event, and cancel the next UI update
|
18700
|
-
* // to prevent updating time
|
18729
|
+
* // to prevent updating time after the DOM element was removed.
|
18701
18730
|
* element.bind('$destroy', function() {
|
18702
18731
|
* $interval.cancel(stopTime);
|
18703
18732
|
* });
|
18704
18733
|
* }
|
18705
18734
|
* });
|
18706
|
-
*
|
18735
|
+
* </script>
|
18707
18736
|
*
|
18708
|
-
*
|
18709
|
-
*
|
18710
|
-
*
|
18711
|
-
*
|
18712
|
-
*
|
18713
|
-
*
|
18714
|
-
*
|
18715
|
-
*
|
18716
|
-
*
|
18717
|
-
*
|
18718
|
-
* </div>
|
18737
|
+
* <div>
|
18738
|
+
* <div ng-controller="ExampleController">
|
18739
|
+
* Date format: <input ng-model="format"> <hr/>
|
18740
|
+
* Current time is: <span my-current-time="format"></span>
|
18741
|
+
* <hr/>
|
18742
|
+
* Blood 1 : <font color='red'>{{blood_1}}</font>
|
18743
|
+
* Blood 2 : <font color='red'>{{blood_2}}</font>
|
18744
|
+
* <button type="button" data-ng-click="fight()">Fight</button>
|
18745
|
+
* <button type="button" data-ng-click="stopFight()">StopFight</button>
|
18746
|
+
* <button type="button" data-ng-click="resetFight()">resetFight</button>
|
18719
18747
|
* </div>
|
18748
|
+
* </div>
|
18720
18749
|
*
|
18721
|
-
*
|
18750
|
+
* </file>
|
18722
18751
|
* </example>
|
18723
18752
|
*/
|
18724
18753
|
function interval(fn, delay, count, invokeApply) {
|
@@ -19275,14 +19304,17 @@ LocationHashbangInHtml5Url.prototype =
|
|
19275
19304
|
* If the argument is a hash object containing an array of values, these values will be encoded
|
19276
19305
|
* as duplicate search parameters in the url.
|
19277
19306
|
*
|
19278
|
-
* @param {(string|Array<string
|
19279
|
-
* override only a single search property.
|
19307
|
+
* @param {(string|Array<string>|boolean)=} paramValue If `search` is a string, then `paramValue`
|
19308
|
+
* will override only a single search property.
|
19280
19309
|
*
|
19281
19310
|
* If `paramValue` is an array, it will override the property of the `search` component of
|
19282
19311
|
* `$location` specified via the first argument.
|
19283
19312
|
*
|
19284
19313
|
* If `paramValue` is `null`, the property specified via the first argument will be deleted.
|
19285
19314
|
*
|
19315
|
+
* If `paramValue` is `true`, the property specified via the first argument will be added with no
|
19316
|
+
* value nor trailing equal sign.
|
19317
|
+
*
|
19286
19318
|
* @return {Object} If called with no arguments returns the parsed `search` object. If called with
|
19287
19319
|
* one or more arguments returns `$location` object itself.
|
19288
19320
|
*/
|
@@ -19294,6 +19326,11 @@ LocationHashbangInHtml5Url.prototype =
|
|
19294
19326
|
if (isString(search)) {
|
19295
19327
|
this.$$search = parseKeyValue(search);
|
19296
19328
|
} else if (isObject(search)) {
|
19329
|
+
// remove object undefined or null properties
|
19330
|
+
forEach(search, function(value, key) {
|
19331
|
+
if (value == null) delete search[key];
|
19332
|
+
});
|
19333
|
+
|
19297
19334
|
this.$$search = search;
|
19298
19335
|
} else {
|
19299
19336
|
throw $locationMinErr('isrcharg',
|
@@ -19615,15 +19652,16 @@ function $LocationProvider(){
|
|
19615
19652
|
* {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this.
|
19616
19653
|
*
|
19617
19654
|
* @example
|
19618
|
-
<example>
|
19655
|
+
<example module="logExample">
|
19619
19656
|
<file name="script.js">
|
19620
|
-
|
19621
|
-
$scope
|
19622
|
-
|
19623
|
-
|
19657
|
+
angular.module('logExample', [])
|
19658
|
+
.controller('LogController', ['$scope', '$log', function($scope, $log) {
|
19659
|
+
$scope.$log = $log;
|
19660
|
+
$scope.message = 'Hello World!';
|
19661
|
+
}]);
|
19624
19662
|
</file>
|
19625
19663
|
<file name="index.html">
|
19626
|
-
<div ng-controller="
|
19664
|
+
<div ng-controller="LogController">
|
19627
19665
|
<p>Reload this page with open console, enter text and hit the log button...</p>
|
19628
19666
|
Message:
|
19629
19667
|
<input type="text" ng-model="message"/>
|
@@ -19647,7 +19685,7 @@ function $LogProvider(){
|
|
19647
19685
|
self = this;
|
19648
19686
|
|
19649
19687
|
/**
|
19650
|
-
* @ngdoc
|
19688
|
+
* @ngdoc method
|
19651
19689
|
* @name $logProvider#debugEnabled
|
19652
19690
|
* @description
|
19653
19691
|
* @param {boolean=} flag enable or disable debug level messages
|
@@ -20746,26 +20784,6 @@ function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {
|
|
20746
20784
|
};
|
20747
20785
|
}
|
20748
20786
|
|
20749
|
-
function simpleGetterFn1(key0, fullExp) {
|
20750
|
-
ensureSafeMemberName(key0, fullExp);
|
20751
|
-
|
20752
|
-
return function simpleGetterFn1(scope, locals) {
|
20753
|
-
if (scope == null) return undefined;
|
20754
|
-
return ((locals && locals.hasOwnProperty(key0)) ? locals : scope)[key0];
|
20755
|
-
};
|
20756
|
-
}
|
20757
|
-
|
20758
|
-
function simpleGetterFn2(key0, key1, fullExp) {
|
20759
|
-
ensureSafeMemberName(key0, fullExp);
|
20760
|
-
ensureSafeMemberName(key1, fullExp);
|
20761
|
-
|
20762
|
-
return function simpleGetterFn2(scope, locals) {
|
20763
|
-
if (scope == null) return undefined;
|
20764
|
-
scope = ((locals && locals.hasOwnProperty(key0)) ? locals : scope)[key0];
|
20765
|
-
return scope == null ? undefined : scope[key1];
|
20766
|
-
};
|
20767
|
-
}
|
20768
|
-
|
20769
20787
|
function getterFn(path, options, fullExp) {
|
20770
20788
|
// Check whether the cache has this getter already.
|
20771
20789
|
// We can use hasOwnProperty directly on the cache because we ensure,
|
@@ -20778,13 +20796,8 @@ function getterFn(path, options, fullExp) {
|
|
20778
20796
|
pathKeysLength = pathKeys.length,
|
20779
20797
|
fn;
|
20780
20798
|
|
20781
|
-
// When we have only 1 or 2 tokens, use optimized special case closures.
|
20782
20799
|
// http://jsperf.com/angularjs-parse-getter/6
|
20783
|
-
if (
|
20784
|
-
fn = simpleGetterFn1(pathKeys[0], fullExp);
|
20785
|
-
} else if (!options.unwrapPromises && pathKeysLength === 2) {
|
20786
|
-
fn = simpleGetterFn2(pathKeys[0], pathKeys[1], fullExp);
|
20787
|
-
} else if (options.csp) {
|
20800
|
+
if (options.csp) {
|
20788
20801
|
if (pathKeysLength < 6) {
|
20789
20802
|
fn = cspSafeGetterFn(pathKeys[0], pathKeys[1], pathKeys[2], pathKeys[3], pathKeys[4], fullExp,
|
20790
20803
|
options);
|
@@ -22911,19 +22924,21 @@ function adjustMatchers(matchers) {
|
|
22911
22924
|
*
|
22912
22925
|
* Here is what a secure configuration for this scenario might look like:
|
22913
22926
|
*
|
22914
|
-
*
|
22915
|
-
*
|
22916
|
-
*
|
22917
|
-
*
|
22918
|
-
*
|
22919
|
-
*
|
22920
|
-
*
|
22921
|
-
*
|
22922
|
-
*
|
22923
|
-
*
|
22924
|
-
*
|
22925
|
-
*
|
22926
|
-
*
|
22927
|
+
* ```
|
22928
|
+
* angular.module('myApp', []).config(function($sceDelegateProvider) {
|
22929
|
+
* $sceDelegateProvider.resourceUrlWhitelist([
|
22930
|
+
* // Allow same origin resource loads.
|
22931
|
+
* 'self',
|
22932
|
+
* // Allow loading from our assets domain. Notice the difference between * and **.
|
22933
|
+
* 'http://srv*.assets.example.com/**'
|
22934
|
+
* ]);
|
22935
|
+
*
|
22936
|
+
* // The blacklist overrides the whitelist so the open redirect here is blocked.
|
22937
|
+
* $sceDelegateProvider.resourceUrlBlacklist([
|
22938
|
+
* 'http://myapp.example.com/clickThru**'
|
22939
|
+
* ]);
|
22940
|
+
* });
|
22941
|
+
* ```
|
22927
22942
|
*/
|
22928
22943
|
|
22929
22944
|
function $SceDelegateProvider() {
|
@@ -23218,10 +23233,10 @@ function $SceDelegateProvider() {
|
|
23218
23233
|
*
|
23219
23234
|
* Here's an example of a binding in a privileged context:
|
23220
23235
|
*
|
23221
|
-
*
|
23222
|
-
*
|
23223
|
-
*
|
23224
|
-
*
|
23236
|
+
* ```
|
23237
|
+
* <input ng-model="userHtml">
|
23238
|
+
* <div ng-bind-html="userHtml"></div>
|
23239
|
+
* ```
|
23225
23240
|
*
|
23226
23241
|
* Notice that `ng-bind-html` is bound to `userHtml` controlled by the user. With SCE
|
23227
23242
|
* disabled, this application allows the user to render arbitrary HTML into the DIV.
|
@@ -23261,15 +23276,15 @@ function $SceDelegateProvider() {
|
|
23261
23276
|
* ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly
|
23262
23277
|
* simplified):
|
23263
23278
|
*
|
23264
|
-
*
|
23265
|
-
*
|
23266
|
-
*
|
23267
|
-
*
|
23268
|
-
*
|
23269
|
-
*
|
23270
|
-
*
|
23271
|
-
*
|
23272
|
-
*
|
23279
|
+
* ```
|
23280
|
+
* var ngBindHtmlDirective = ['$sce', function($sce) {
|
23281
|
+
* return function(scope, element, attr) {
|
23282
|
+
* scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) {
|
23283
|
+
* element.html(value || '');
|
23284
|
+
* });
|
23285
|
+
* };
|
23286
|
+
* }];
|
23287
|
+
* ```
|
23273
23288
|
*
|
23274
23289
|
* ## Impact on loading templates
|
23275
23290
|
*
|
@@ -23373,66 +23388,65 @@ function $SceDelegateProvider() {
|
|
23373
23388
|
*
|
23374
23389
|
* ## Show me an example using SCE.
|
23375
23390
|
*
|
23376
|
-
*
|
23377
|
-
<
|
23378
|
-
<
|
23379
|
-
|
23380
|
-
|
23381
|
-
|
23382
|
-
|
23383
|
-
|
23384
|
-
|
23385
|
-
|
23386
|
-
|
23387
|
-
|
23388
|
-
|
23389
|
-
|
23390
|
-
|
23391
|
-
|
23392
|
-
|
23393
|
-
|
23394
|
-
|
23395
|
-
|
23396
|
-
|
23397
|
-
|
23398
|
-
|
23399
|
-
|
23400
|
-
|
23401
|
-
|
23402
|
-
|
23403
|
-
|
23404
|
-
|
23405
|
-
|
23406
|
-
|
23407
|
-
|
23408
|
-
|
23409
|
-
|
23410
|
-
|
23411
|
-
|
23412
|
-
|
23413
|
-
|
23414
|
-
|
23415
|
-
|
23416
|
-
|
23417
|
-
|
23418
|
-
|
23419
|
-
|
23420
|
-
|
23421
|
-
|
23422
|
-
|
23423
|
-
|
23424
|
-
|
23425
|
-
|
23426
|
-
|
23427
|
-
|
23428
|
-
|
23429
|
-
|
23430
|
-
|
23431
|
-
|
23432
|
-
|
23433
|
-
|
23434
|
-
</
|
23435
|
-
</example>
|
23391
|
+
* <example module="mySceApp" deps="angular-sanitize.js">
|
23392
|
+
* <file name="index.html">
|
23393
|
+
* <div ng-controller="myAppController as myCtrl">
|
23394
|
+
* <i ng-bind-html="myCtrl.explicitlyTrustedHtml" id="explicitlyTrustedHtml"></i><br><br>
|
23395
|
+
* <b>User comments</b><br>
|
23396
|
+
* By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when
|
23397
|
+
* $sanitize is available. If $sanitize isn't available, this results in an error instead of an
|
23398
|
+
* exploit.
|
23399
|
+
* <div class="well">
|
23400
|
+
* <div ng-repeat="userComment in myCtrl.userComments">
|
23401
|
+
* <b>{{userComment.name}}</b>:
|
23402
|
+
* <span ng-bind-html="userComment.htmlComment" class="htmlComment"></span>
|
23403
|
+
* <br>
|
23404
|
+
* </div>
|
23405
|
+
* </div>
|
23406
|
+
* </div>
|
23407
|
+
* </file>
|
23408
|
+
*
|
23409
|
+
* <file name="script.js">
|
23410
|
+
* var mySceApp = angular.module('mySceApp', ['ngSanitize']);
|
23411
|
+
*
|
23412
|
+
* mySceApp.controller("myAppController", function myAppController($http, $templateCache, $sce) {
|
23413
|
+
* var self = this;
|
23414
|
+
* $http.get("test_data.json", {cache: $templateCache}).success(function(userComments) {
|
23415
|
+
* self.userComments = userComments;
|
23416
|
+
* });
|
23417
|
+
* self.explicitlyTrustedHtml = $sce.trustAsHtml(
|
23418
|
+
* '<span onmouseover="this.textContent="Explicitly trusted HTML bypasses ' +
|
23419
|
+
* 'sanitization."">Hover over this text.</span>');
|
23420
|
+
* });
|
23421
|
+
* </file>
|
23422
|
+
*
|
23423
|
+
* <file name="test_data.json">
|
23424
|
+
* [
|
23425
|
+
* { "name": "Alice",
|
23426
|
+
* "htmlComment":
|
23427
|
+
* "<span onmouseover='this.textContent=\"PWN3D!\"'>Is <i>anyone</i> reading this?</span>"
|
23428
|
+
* },
|
23429
|
+
* { "name": "Bob",
|
23430
|
+
* "htmlComment": "<i>Yes!</i> Am I the only other one?"
|
23431
|
+
* }
|
23432
|
+
* ]
|
23433
|
+
* </file>
|
23434
|
+
*
|
23435
|
+
* <file name="protractor.js" type="protractor">
|
23436
|
+
* describe('SCE doc demo', function() {
|
23437
|
+
* it('should sanitize untrusted values', function() {
|
23438
|
+
* expect(element.all(by.css('.htmlComment')).first().getInnerHtml())
|
23439
|
+
* .toBe('<span>Is <i>anyone</i> reading this?</span>');
|
23440
|
+
* });
|
23441
|
+
*
|
23442
|
+
* it('should NOT sanitize explicitly trusted values', function() {
|
23443
|
+
* expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe(
|
23444
|
+
* '<span onmouseover="this.textContent="Explicitly trusted HTML bypasses ' +
|
23445
|
+
* 'sanitization."">Hover over this text.</span>');
|
23446
|
+
* });
|
23447
|
+
* });
|
23448
|
+
* </file>
|
23449
|
+
* </example>
|
23436
23450
|
*
|
23437
23451
|
*
|
23438
23452
|
*
|
@@ -23446,13 +23460,13 @@ function $SceDelegateProvider() {
|
|
23446
23460
|
*
|
23447
23461
|
* That said, here's how you can completely disable SCE:
|
23448
23462
|
*
|
23449
|
-
*
|
23450
|
-
*
|
23451
|
-
*
|
23452
|
-
*
|
23453
|
-
*
|
23454
|
-
*
|
23455
|
-
*
|
23463
|
+
* ```
|
23464
|
+
* angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {
|
23465
|
+
* // Completely disable SCE. For demonstration purposes only!
|
23466
|
+
* // Do not use in new projects.
|
23467
|
+
* $sceProvider.enabled(false);
|
23468
|
+
* });
|
23469
|
+
* ```
|
23456
23470
|
*
|
23457
23471
|
*/
|
23458
23472
|
/* jshint maxlen: 100 */
|
@@ -24149,17 +24163,18 @@ function urlIsSameOrigin(requestUrl) {
|
|
24149
24163
|
* expression.
|
24150
24164
|
*
|
24151
24165
|
* @example
|
24152
|
-
<example>
|
24166
|
+
<example module="windowExample">
|
24153
24167
|
<file name="index.html">
|
24154
24168
|
<script>
|
24155
|
-
|
24156
|
-
$scope
|
24157
|
-
|
24169
|
+
angular.module('windowExample', [])
|
24170
|
+
.controller('ExampleController', ['$scope', '$window', function ($scope, $window) {
|
24171
|
+
$scope.greeting = 'Hello, World!';
|
24172
|
+
$scope.doGreeting = function(greeting) {
|
24158
24173
|
$window.alert(greeting);
|
24159
|
-
|
24160
|
-
|
24174
|
+
};
|
24175
|
+
}]);
|
24161
24176
|
</script>
|
24162
|
-
<div ng-controller="
|
24177
|
+
<div ng-controller="ExampleController">
|
24163
24178
|
<input type="text" ng-model="greeting" />
|
24164
24179
|
<button ng-click="doGreeting(greeting)">ALERT</button>
|
24165
24180
|
</div>
|
@@ -24558,14 +24573,15 @@ function filterFilter() {
|
|
24558
24573
|
*
|
24559
24574
|
*
|
24560
24575
|
* @example
|
24561
|
-
<example>
|
24576
|
+
<example module="currencyExample">
|
24562
24577
|
<file name="index.html">
|
24563
24578
|
<script>
|
24564
|
-
|
24565
|
-
$scope
|
24566
|
-
|
24579
|
+
angular.module('currencyExample', [])
|
24580
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
24581
|
+
$scope.amount = 1234.56;
|
24582
|
+
}]);
|
24567
24583
|
</script>
|
24568
|
-
<div ng-controller="
|
24584
|
+
<div ng-controller="ExampleController">
|
24569
24585
|
<input type="number" ng-model="amount"> <br>
|
24570
24586
|
default currency symbol ($): <span id="currency-default">{{amount | currency}}</span><br>
|
24571
24587
|
custom currency identifier (USD$): <span>{{amount | currency:"USD$"}}</span>
|
@@ -24617,14 +24633,15 @@ function currencyFilter($locale) {
|
|
24617
24633
|
* @returns {string} Number rounded to decimalPlaces and places a “,” after each third digit.
|
24618
24634
|
*
|
24619
24635
|
* @example
|
24620
|
-
<example>
|
24636
|
+
<example module="numberFilterExample">
|
24621
24637
|
<file name="index.html">
|
24622
24638
|
<script>
|
24623
|
-
|
24624
|
-
$scope
|
24625
|
-
|
24639
|
+
angular.module('numberFilterExample', [])
|
24640
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
24641
|
+
$scope.val = 1234.56789;
|
24642
|
+
}]);
|
24626
24643
|
</script>
|
24627
|
-
<div ng-controller="
|
24644
|
+
<div ng-controller="ExampleController">
|
24628
24645
|
Enter number: <input ng-model='val'><br>
|
24629
24646
|
Default formatting: <span id='number-default'>{{val | number}}</span><br>
|
24630
24647
|
No fractions: <span>{{val | number:0}}</span><br>
|
@@ -25048,17 +25065,18 @@ var uppercaseFilter = valueFn(uppercase);
|
|
25048
25065
|
* had less than `limit` elements.
|
25049
25066
|
*
|
25050
25067
|
* @example
|
25051
|
-
<example>
|
25068
|
+
<example module="limitToExample">
|
25052
25069
|
<file name="index.html">
|
25053
25070
|
<script>
|
25054
|
-
|
25055
|
-
$scope
|
25056
|
-
|
25057
|
-
|
25058
|
-
|
25059
|
-
|
25071
|
+
angular.module('limitToExample', [])
|
25072
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
25073
|
+
$scope.numbers = [1,2,3,4,5,6,7,8,9];
|
25074
|
+
$scope.letters = "abcdefghi";
|
25075
|
+
$scope.numLimit = 3;
|
25076
|
+
$scope.letterLimit = 3;
|
25077
|
+
}]);
|
25060
25078
|
</script>
|
25061
|
-
<div ng-controller="
|
25079
|
+
<div ng-controller="ExampleController">
|
25062
25080
|
Limit {{numbers}} to: <input type="integer" ng-model="numLimit">
|
25063
25081
|
<p>Output numbers: {{ numbers | limitTo:numLimit }}</p>
|
25064
25082
|
Limit {{letters}} to: <input type="integer" ng-model="letterLimit">
|
@@ -25170,20 +25188,21 @@ function limitToFilter(){
|
|
25170
25188
|
* @returns {Array} Sorted copy of the source array.
|
25171
25189
|
*
|
25172
25190
|
* @example
|
25173
|
-
<example>
|
25191
|
+
<example module="orderByExample">
|
25174
25192
|
<file name="index.html">
|
25175
25193
|
<script>
|
25176
|
-
|
25177
|
-
$scope
|
25178
|
-
|
25179
|
-
|
25180
|
-
|
25181
|
-
|
25182
|
-
|
25183
|
-
|
25184
|
-
|
25194
|
+
angular.module('orderByExample', [])
|
25195
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
25196
|
+
$scope.friends =
|
25197
|
+
[{name:'John', phone:'555-1212', age:10},
|
25198
|
+
{name:'Mary', phone:'555-9876', age:19},
|
25199
|
+
{name:'Mike', phone:'555-4321', age:21},
|
25200
|
+
{name:'Adam', phone:'555-5678', age:35},
|
25201
|
+
{name:'Julie', phone:'555-8765', age:29}];
|
25202
|
+
$scope.predicate = '-age';
|
25203
|
+
}]);
|
25185
25204
|
</script>
|
25186
|
-
<div ng-controller="
|
25205
|
+
<div ng-controller="ExampleController">
|
25187
25206
|
<pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>
|
25188
25207
|
<hr/>
|
25189
25208
|
[ <a href="" ng-click="predicate=''">unsorted</a> ]
|
@@ -25211,7 +25230,7 @@ function limitToFilter(){
|
|
25211
25230
|
* Example:
|
25212
25231
|
*
|
25213
25232
|
* @example
|
25214
|
-
<example>
|
25233
|
+
<example module="orderByExample">
|
25215
25234
|
<file name="index.html">
|
25216
25235
|
<div ng-controller="Ctrl">
|
25217
25236
|
<table class="friend">
|
@@ -25231,21 +25250,21 @@ function limitToFilter(){
|
|
25231
25250
|
</file>
|
25232
25251
|
|
25233
25252
|
<file name="script.js">
|
25234
|
-
|
25235
|
-
|
25236
|
-
|
25237
|
-
|
25238
|
-
|
25239
|
-
|
25240
|
-
|
25241
|
-
|
25242
|
-
|
25243
|
-
|
25244
|
-
|
25245
|
-
|
25246
|
-
|
25247
|
-
|
25248
|
-
|
25253
|
+
angular.module('orderByExample', [])
|
25254
|
+
.controller('ExampleController', ['$scope', '$filter', function($scope, $filter) {
|
25255
|
+
var orderBy = $filter('orderBy');
|
25256
|
+
$scope.friends = [
|
25257
|
+
{ name: 'John', phone: '555-1212', age: 10 },
|
25258
|
+
{ name: 'Mary', phone: '555-9876', age: 19 },
|
25259
|
+
{ name: 'Mike', phone: '555-4321', age: 21 },
|
25260
|
+
{ name: 'Adam', phone: '555-5678', age: 35 },
|
25261
|
+
{ name: 'Julie', phone: '555-8765', age: 29 }
|
25262
|
+
];
|
25263
|
+
$scope.order = function(predicate, reverse) {
|
25264
|
+
$scope.friends = orderBy($scope.friends, predicate, reverse);
|
25265
|
+
};
|
25266
|
+
$scope.order('-age',false);
|
25267
|
+
}]);
|
25249
25268
|
</file>
|
25250
25269
|
</example>
|
25251
25270
|
*/
|
@@ -25431,7 +25450,7 @@ var htmlAnchorDirective = valueFn({
|
|
25431
25450
|
return browser.driver.getCurrentUrl().then(function(url) {
|
25432
25451
|
return url.match(/\/123$/);
|
25433
25452
|
});
|
25434
|
-
},
|
25453
|
+
}, 5000, 'page should navigate to /123');
|
25435
25454
|
});
|
25436
25455
|
|
25437
25456
|
xit('should execute ng-click but not reload when href empty string and name specified', function() {
|
@@ -25459,7 +25478,7 @@ var htmlAnchorDirective = valueFn({
|
|
25459
25478
|
return browser.driver.getCurrentUrl().then(function(url) {
|
25460
25479
|
return url.match(/\/6$/);
|
25461
25480
|
});
|
25462
|
-
},
|
25481
|
+
}, 5000, 'page should navigate to /6');
|
25463
25482
|
});
|
25464
25483
|
</file>
|
25465
25484
|
</example>
|
@@ -26075,12 +26094,13 @@ function FormController(element, attrs, $scope, $animate) {
|
|
26075
26094
|
* </pre>
|
26076
26095
|
*
|
26077
26096
|
* @example
|
26078
|
-
<example deps="angular-animate.js" animations="true" fixBase="true">
|
26097
|
+
<example deps="angular-animate.js" animations="true" fixBase="true" module="formExample">
|
26079
26098
|
<file name="index.html">
|
26080
26099
|
<script>
|
26081
|
-
|
26082
|
-
$scope
|
26083
|
-
|
26100
|
+
angular.module('formExample', [])
|
26101
|
+
.controller('FormController', ['$scope', function($scope) {
|
26102
|
+
$scope.userType = 'guest';
|
26103
|
+
}]);
|
26084
26104
|
</script>
|
26085
26105
|
<style>
|
26086
26106
|
.my-form {
|
@@ -26092,7 +26112,7 @@ function FormController(element, attrs, $scope, $animate) {
|
|
26092
26112
|
background: red;
|
26093
26113
|
}
|
26094
26114
|
</style>
|
26095
|
-
<form name="myForm" ng-controller="
|
26115
|
+
<form name="myForm" ng-controller="FormController" class="my-form">
|
26096
26116
|
userType: <input name="input" ng-model="userType" required>
|
26097
26117
|
<span class="error" ng-show="myForm.input.$error.required">Required!</span><br>
|
26098
26118
|
<tt>userType = {{userType}}</tt><br>
|
@@ -26195,7 +26215,7 @@ var ngFormDirective = formDirectiveFactory(true);
|
|
26195
26215
|
*/
|
26196
26216
|
|
26197
26217
|
var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
|
26198
|
-
var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9-]
|
26218
|
+
var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;
|
26199
26219
|
var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/;
|
26200
26220
|
|
26201
26221
|
var inputType = {
|
@@ -26225,15 +26245,16 @@ var inputType = {
|
|
26225
26245
|
* @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
|
26226
26246
|
*
|
26227
26247
|
* @example
|
26228
|
-
<example name="text-input-directive">
|
26248
|
+
<example name="text-input-directive" module="textInputExample">
|
26229
26249
|
<file name="index.html">
|
26230
26250
|
<script>
|
26231
|
-
|
26232
|
-
$scope
|
26233
|
-
|
26234
|
-
|
26251
|
+
angular.module('textInputExample', [])
|
26252
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
26253
|
+
$scope.text = 'guest';
|
26254
|
+
$scope.word = /^\s*\w*\s*$/;
|
26255
|
+
}]);
|
26235
26256
|
</script>
|
26236
|
-
<form name="myForm" ng-controller="
|
26257
|
+
<form name="myForm" ng-controller="ExampleController">
|
26237
26258
|
Single word: <input type="text" name="input" ng-model="text"
|
26238
26259
|
ng-pattern="word" required ng-trim="false">
|
26239
26260
|
<span class="error" ng-show="myForm.input.$error.required">
|
@@ -26305,14 +26326,15 @@ var inputType = {
|
|
26305
26326
|
* interaction with the input element.
|
26306
26327
|
*
|
26307
26328
|
* @example
|
26308
|
-
<example name="number-input-directive">
|
26329
|
+
<example name="number-input-directive" module="numberExample">
|
26309
26330
|
<file name="index.html">
|
26310
26331
|
<script>
|
26311
|
-
|
26312
|
-
$scope
|
26313
|
-
|
26332
|
+
angular.module('numberExample', [])
|
26333
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
26334
|
+
$scope.value = 12;
|
26335
|
+
}]);
|
26314
26336
|
</script>
|
26315
|
-
<form name="myForm" ng-controller="
|
26337
|
+
<form name="myForm" ng-controller="ExampleController">
|
26316
26338
|
Number: <input type="number" name="input" ng-model="value"
|
26317
26339
|
min="0" max="99" required>
|
26318
26340
|
<span class="error" ng-show="myForm.input.$error.required">
|
@@ -26380,14 +26402,15 @@ var inputType = {
|
|
26380
26402
|
* interaction with the input element.
|
26381
26403
|
*
|
26382
26404
|
* @example
|
26383
|
-
<example name="url-input-directive">
|
26405
|
+
<example name="url-input-directive" module="urlExample">
|
26384
26406
|
<file name="index.html">
|
26385
26407
|
<script>
|
26386
|
-
|
26387
|
-
$scope
|
26388
|
-
|
26408
|
+
angular.module('urlExample', [])
|
26409
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
26410
|
+
$scope.text = 'http://google.com';
|
26411
|
+
}]);
|
26389
26412
|
</script>
|
26390
|
-
<form name="myForm" ng-controller="
|
26413
|
+
<form name="myForm" ng-controller="ExampleController">
|
26391
26414
|
URL: <input type="url" name="input" ng-model="text" required>
|
26392
26415
|
<span class="error" ng-show="myForm.input.$error.required">
|
26393
26416
|
Required!</span>
|
@@ -26456,14 +26479,15 @@ var inputType = {
|
|
26456
26479
|
* interaction with the input element.
|
26457
26480
|
*
|
26458
26481
|
* @example
|
26459
|
-
<example name="email-input-directive">
|
26482
|
+
<example name="email-input-directive" module="emailExample">
|
26460
26483
|
<file name="index.html">
|
26461
26484
|
<script>
|
26462
|
-
|
26463
|
-
$scope
|
26464
|
-
|
26485
|
+
angular.module('emailExample', [])
|
26486
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
26487
|
+
$scope.text = 'me@example.com';
|
26488
|
+
}]);
|
26465
26489
|
</script>
|
26466
|
-
<form name="myForm" ng-controller="
|
26490
|
+
<form name="myForm" ng-controller="ExampleController">
|
26467
26491
|
Email: <input type="email" name="input" ng-model="text" required>
|
26468
26492
|
<span class="error" ng-show="myForm.input.$error.required">
|
26469
26493
|
Required!</span>
|
@@ -26522,18 +26546,19 @@ var inputType = {
|
|
26522
26546
|
* be set when selected.
|
26523
26547
|
*
|
26524
26548
|
* @example
|
26525
|
-
<example name="radio-input-directive">
|
26549
|
+
<example name="radio-input-directive" module="radioExample">
|
26526
26550
|
<file name="index.html">
|
26527
26551
|
<script>
|
26528
|
-
|
26529
|
-
$scope
|
26530
|
-
|
26531
|
-
|
26532
|
-
|
26533
|
-
|
26534
|
-
|
26552
|
+
angular.module('radioExample', [])
|
26553
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
26554
|
+
$scope.color = 'blue';
|
26555
|
+
$scope.specialValue = {
|
26556
|
+
"id": "12345",
|
26557
|
+
"value": "green"
|
26558
|
+
};
|
26559
|
+
}]);
|
26535
26560
|
</script>
|
26536
|
-
<form name="myForm" ng-controller="
|
26561
|
+
<form name="myForm" ng-controller="ExampleController">
|
26537
26562
|
<input type="radio" ng-model="color" value="red"> Red <br/>
|
26538
26563
|
<input type="radio" ng-model="color" ng-value="specialValue"> Green <br/>
|
26539
26564
|
<input type="radio" ng-model="color" value="blue"> Blue <br/>
|
@@ -26572,15 +26597,16 @@ var inputType = {
|
|
26572
26597
|
* interaction with the input element.
|
26573
26598
|
*
|
26574
26599
|
* @example
|
26575
|
-
<example name="checkbox-input-directive">
|
26600
|
+
<example name="checkbox-input-directive" module="checkboxExample">
|
26576
26601
|
<file name="index.html">
|
26577
26602
|
<script>
|
26578
|
-
|
26579
|
-
$scope
|
26580
|
-
|
26581
|
-
|
26603
|
+
angular.module('checkboxExample', [])
|
26604
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
26605
|
+
$scope.value1 = true;
|
26606
|
+
$scope.value2 = 'YES'
|
26607
|
+
}]);
|
26582
26608
|
</script>
|
26583
|
-
<form name="myForm" ng-controller="
|
26609
|
+
<form name="myForm" ng-controller="ExampleController">
|
26584
26610
|
Value1: <input type="checkbox" ng-model="value1"> <br/>
|
26585
26611
|
Value2: <input type="checkbox" ng-model="value2"
|
26586
26612
|
ng-true-value="YES" ng-false-value="NO"> <br/>
|
@@ -26980,14 +27006,15 @@ function checkboxInputType(scope, element, attr, ctrl) {
|
|
26980
27006
|
* interaction with the input element.
|
26981
27007
|
*
|
26982
27008
|
* @example
|
26983
|
-
<example name="input-directive">
|
27009
|
+
<example name="input-directive" module="inputExample">
|
26984
27010
|
<file name="index.html">
|
26985
27011
|
<script>
|
26986
|
-
|
26987
|
-
|
26988
|
-
|
27012
|
+
angular.module('inputExample', [])
|
27013
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
27014
|
+
$scope.user = {name: 'guest', last: 'visitor'};
|
27015
|
+
}]);
|
26989
27016
|
</script>
|
26990
|
-
<div ng-controller="
|
27017
|
+
<div ng-controller="ExampleController">
|
26991
27018
|
<form name="myForm">
|
26992
27019
|
User name: <input type="text" name="userName" ng-model="user.name" required>
|
26993
27020
|
<span class="error" ng-show="myForm.userName.$error.required">
|
@@ -27505,12 +27532,13 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
|
|
27505
27532
|
* </pre>
|
27506
27533
|
*
|
27507
27534
|
* @example
|
27508
|
-
* <example deps="angular-animate.js" animations="true" fixBase="true">
|
27535
|
+
* <example deps="angular-animate.js" animations="true" fixBase="true" module="inputExample">
|
27509
27536
|
<file name="index.html">
|
27510
27537
|
<script>
|
27511
|
-
|
27512
|
-
$scope
|
27513
|
-
|
27538
|
+
angular.module('inputExample', [])
|
27539
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
27540
|
+
$scope.val = '1';
|
27541
|
+
}]);
|
27514
27542
|
</script>
|
27515
27543
|
<style>
|
27516
27544
|
.my-input {
|
@@ -27525,7 +27553,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
|
|
27525
27553
|
</style>
|
27526
27554
|
Update input to see transitions when valid/invalid.
|
27527
27555
|
Integer is a valid value.
|
27528
|
-
<form name="testForm" ng-controller="
|
27556
|
+
<form name="testForm" ng-controller="ExampleController">
|
27529
27557
|
<input ng-model="val" ng-pattern="/^\d+$/" name="anim" class="my-input" />
|
27530
27558
|
</form>
|
27531
27559
|
</file>
|
@@ -27569,17 +27597,18 @@ var ngModelDirective = function() {
|
|
27569
27597
|
* in input value.
|
27570
27598
|
*
|
27571
27599
|
* @example
|
27572
|
-
* <example name="ngChange-directive">
|
27600
|
+
* <example name="ngChange-directive" module="changeExample">
|
27573
27601
|
* <file name="index.html">
|
27574
27602
|
* <script>
|
27575
|
-
*
|
27576
|
-
* $scope
|
27577
|
-
*
|
27578
|
-
* $scope.
|
27579
|
-
*
|
27580
|
-
*
|
27603
|
+
* angular.module('changeExample', [])
|
27604
|
+
* .controller('ExampleController', ['$scope', function($scope) {
|
27605
|
+
* $scope.counter = 0;
|
27606
|
+
* $scope.change = function() {
|
27607
|
+
* $scope.counter++;
|
27608
|
+
* };
|
27609
|
+
* }]);
|
27581
27610
|
* </script>
|
27582
|
-
* <div ng-controller="
|
27611
|
+
* <div ng-controller="ExampleController">
|
27583
27612
|
* <input type="checkbox" ng-model="confirmed" ng-change="change()" id="ng-change-example1" />
|
27584
27613
|
* <input type="checkbox" ng-model="confirmed" id="ng-change-example2" />
|
27585
27614
|
* <label for="ng-change-example2">Confirmed</label><br />
|
@@ -27660,14 +27689,15 @@ var requiredDirective = function() {
|
|
27660
27689
|
* specified in form `/something/` then the value will be converted into a regular expression.
|
27661
27690
|
*
|
27662
27691
|
* @example
|
27663
|
-
<example name="ngList-directive">
|
27692
|
+
<example name="ngList-directive" module="listExample">
|
27664
27693
|
<file name="index.html">
|
27665
27694
|
<script>
|
27666
|
-
|
27667
|
-
|
27668
|
-
|
27695
|
+
angular.module('listExample', [])
|
27696
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
27697
|
+
$scope.names = ['igor', 'misko', 'vojta'];
|
27698
|
+
}]);
|
27669
27699
|
</script>
|
27670
|
-
<form name="myForm" ng-controller="
|
27700
|
+
<form name="myForm" ng-controller="ExampleController">
|
27671
27701
|
List: <input name="namesInput" ng-model="names" ng-list required>
|
27672
27702
|
<span class="error" ng-show="myForm.namesInput.$error.required">
|
27673
27703
|
Required!</span>
|
@@ -27759,15 +27789,16 @@ var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
|
|
27759
27789
|
* of the `input` element
|
27760
27790
|
*
|
27761
27791
|
* @example
|
27762
|
-
<example name="ngValue-directive">
|
27792
|
+
<example name="ngValue-directive" module="valueExample">
|
27763
27793
|
<file name="index.html">
|
27764
27794
|
<script>
|
27765
|
-
|
27766
|
-
|
27767
|
-
|
27768
|
-
|
27795
|
+
angular.module('valueExample', [])
|
27796
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
27797
|
+
$scope.names = ['pizza', 'unicorns', 'robots'];
|
27798
|
+
$scope.my = { favorite: 'unicorns' };
|
27799
|
+
}]);
|
27769
27800
|
</script>
|
27770
|
-
<form ng-controller="
|
27801
|
+
<form ng-controller="ExampleController">
|
27771
27802
|
<h2>Which is your favorite?</h2>
|
27772
27803
|
<label ng-repeat="name in names" for="{{name}}">
|
27773
27804
|
{{name}}
|
@@ -27838,14 +27869,15 @@ var ngValueDirective = function() {
|
|
27838
27869
|
*
|
27839
27870
|
* @example
|
27840
27871
|
* Enter a name in the Live Preview text box; the greeting below the text box changes instantly.
|
27841
|
-
<example>
|
27872
|
+
<example module="bindExample">
|
27842
27873
|
<file name="index.html">
|
27843
27874
|
<script>
|
27844
|
-
|
27845
|
-
$scope
|
27846
|
-
|
27875
|
+
angular.module('bindExample', [])
|
27876
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
27877
|
+
$scope.name = 'Whirled';
|
27878
|
+
}]);
|
27847
27879
|
</script>
|
27848
|
-
<div ng-controller="
|
27880
|
+
<div ng-controller="ExampleController">
|
27849
27881
|
Enter name: <input type="text" ng-model="name"><br>
|
27850
27882
|
Hello <span ng-bind="name"></span>!
|
27851
27883
|
</div>
|
@@ -27896,15 +27928,16 @@ var ngBindDirective = ngDirective({
|
|
27896
27928
|
*
|
27897
27929
|
* @example
|
27898
27930
|
* Try it here: enter text in text box and watch the greeting change.
|
27899
|
-
<example>
|
27931
|
+
<example module="bindExample">
|
27900
27932
|
<file name="index.html">
|
27901
27933
|
<script>
|
27902
|
-
|
27903
|
-
$scope
|
27904
|
-
|
27905
|
-
|
27934
|
+
angular.module('bindExample', [])
|
27935
|
+
.controller('ExampleController', ['$scope', function ($scope) {
|
27936
|
+
$scope.salutation = 'Hello';
|
27937
|
+
$scope.name = 'World';
|
27938
|
+
}]);
|
27906
27939
|
</script>
|
27907
|
-
<div ng-controller="
|
27940
|
+
<div ng-controller="ExampleController">
|
27908
27941
|
Salutation: <input type="text" ng-model="salutation"><br>
|
27909
27942
|
Name: <input type="text" ng-model="name"><br>
|
27910
27943
|
<pre ng-bind-template="{{salutation}} {{name}}!"></pre>
|
@@ -27962,20 +27995,20 @@ var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
|
|
27962
27995
|
* @example
|
27963
27996
|
Try it here: enter text in text box and watch the greeting change.
|
27964
27997
|
|
27965
|
-
<example module="
|
27998
|
+
<example module="bindHtmlExample" deps="angular-sanitize.js">
|
27966
27999
|
<file name="index.html">
|
27967
|
-
<div ng-controller="
|
28000
|
+
<div ng-controller="ExampleController">
|
27968
28001
|
<p ng-bind-html="myHTML"></p>
|
27969
28002
|
</div>
|
27970
28003
|
</file>
|
27971
28004
|
|
27972
28005
|
<file name="script.js">
|
27973
|
-
angular.module('
|
27974
|
-
|
27975
|
-
|
27976
|
-
|
27977
|
-
|
27978
|
-
|
28006
|
+
angular.module('bindHtmlExample', ['ngSanitize'])
|
28007
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
28008
|
+
$scope.myHTML =
|
28009
|
+
'I am an <code>HTML</code>string with ' +
|
28010
|
+
'<a href="#">links!</a> and other <em>stuff</em>';
|
28011
|
+
}]);
|
27979
28012
|
</file>
|
27980
28013
|
|
27981
28014
|
<file name="protractor.js" type="protractor">
|
@@ -28474,7 +28507,7 @@ var ngCloakDirective = ngDirective({
|
|
28474
28507
|
*
|
28475
28508
|
* This example demonstrates the `controller as` syntax.
|
28476
28509
|
*
|
28477
|
-
* <example name="ngControllerAs">
|
28510
|
+
* <example name="ngControllerAs" module="controllerAsExample">
|
28478
28511
|
* <file name="index.html">
|
28479
28512
|
* <div id="ctrl-as-exmpl" ng-controller="SettingsController1 as settings">
|
28480
28513
|
* Name: <input type="text" ng-model="settings.name"/>
|
@@ -28495,6 +28528,9 @@ var ngCloakDirective = ngDirective({
|
|
28495
28528
|
* </div>
|
28496
28529
|
* </file>
|
28497
28530
|
* <file name="app.js">
|
28531
|
+
* angular.module('controllerAsExample', [])
|
28532
|
+
* .controller('SettingsController1', SettingsController1);
|
28533
|
+
*
|
28498
28534
|
* function SettingsController1() {
|
28499
28535
|
* this.name = "John Smith";
|
28500
28536
|
* this.contacts = [
|
@@ -28523,29 +28559,29 @@ var ngCloakDirective = ngDirective({
|
|
28523
28559
|
* <file name="protractor.js" type="protractor">
|
28524
28560
|
* it('should check controller as', function() {
|
28525
28561
|
* var container = element(by.id('ctrl-as-exmpl'));
|
28526
|
-
* expect(container.
|
28562
|
+
* expect(container.element(by.model('settings.name'))
|
28527
28563
|
* .getAttribute('value')).toBe('John Smith');
|
28528
28564
|
*
|
28529
28565
|
* var firstRepeat =
|
28530
|
-
* container.
|
28566
|
+
* container.element(by.repeater('contact in settings.contacts').row(0));
|
28531
28567
|
* var secondRepeat =
|
28532
|
-
* container.
|
28568
|
+
* container.element(by.repeater('contact in settings.contacts').row(1));
|
28533
28569
|
*
|
28534
|
-
* expect(firstRepeat.
|
28570
|
+
* expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
|
28535
28571
|
* .toBe('408 555 1212');
|
28536
28572
|
*
|
28537
|
-
* expect(secondRepeat.
|
28573
|
+
* expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))
|
28538
28574
|
* .toBe('john.smith@example.org');
|
28539
28575
|
*
|
28540
|
-
* firstRepeat.
|
28576
|
+
* firstRepeat.element(by.linkText('clear')).click();
|
28541
28577
|
*
|
28542
|
-
* expect(firstRepeat.
|
28578
|
+
* expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
|
28543
28579
|
* .toBe('');
|
28544
28580
|
*
|
28545
|
-
* container.
|
28581
|
+
* container.element(by.linkText('add')).click();
|
28546
28582
|
*
|
28547
|
-
* expect(container.
|
28548
|
-
* .
|
28583
|
+
* expect(container.element(by.repeater('contact in settings.contacts').row(2))
|
28584
|
+
* .element(by.model('contact.value'))
|
28549
28585
|
* .getAttribute('value'))
|
28550
28586
|
* .toBe('yourname@example.org');
|
28551
28587
|
* });
|
@@ -28554,7 +28590,7 @@ var ngCloakDirective = ngDirective({
|
|
28554
28590
|
*
|
28555
28591
|
* This example demonstrates the "attach to `$scope`" style of controller.
|
28556
28592
|
*
|
28557
|
-
* <example name="ngController">
|
28593
|
+
* <example name="ngController" module="controllerExample">
|
28558
28594
|
* <file name="index.html">
|
28559
28595
|
* <div id="ctrl-exmpl" ng-controller="SettingsController2">
|
28560
28596
|
* Name: <input type="text" ng-model="name"/>
|
@@ -28575,6 +28611,9 @@ var ngCloakDirective = ngDirective({
|
|
28575
28611
|
* </div>
|
28576
28612
|
* </file>
|
28577
28613
|
* <file name="app.js">
|
28614
|
+
* angular.module('controllerExample', [])
|
28615
|
+
* .controller('SettingsController2', ['$scope', SettingsController2]);
|
28616
|
+
*
|
28578
28617
|
* function SettingsController2($scope) {
|
28579
28618
|
* $scope.name = "John Smith";
|
28580
28619
|
* $scope.contacts = [
|
@@ -28604,28 +28643,28 @@ var ngCloakDirective = ngDirective({
|
|
28604
28643
|
* it('should check controller', function() {
|
28605
28644
|
* var container = element(by.id('ctrl-exmpl'));
|
28606
28645
|
*
|
28607
|
-
* expect(container.
|
28646
|
+
* expect(container.element(by.model('name'))
|
28608
28647
|
* .getAttribute('value')).toBe('John Smith');
|
28609
28648
|
*
|
28610
28649
|
* var firstRepeat =
|
28611
|
-
* container.
|
28650
|
+
* container.element(by.repeater('contact in contacts').row(0));
|
28612
28651
|
* var secondRepeat =
|
28613
|
-
* container.
|
28652
|
+
* container.element(by.repeater('contact in contacts').row(1));
|
28614
28653
|
*
|
28615
|
-
* expect(firstRepeat.
|
28654
|
+
* expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
|
28616
28655
|
* .toBe('408 555 1212');
|
28617
|
-
* expect(secondRepeat.
|
28656
|
+
* expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))
|
28618
28657
|
* .toBe('john.smith@example.org');
|
28619
28658
|
*
|
28620
|
-
* firstRepeat.
|
28659
|
+
* firstRepeat.element(by.linkText('clear')).click();
|
28621
28660
|
*
|
28622
|
-
* expect(firstRepeat.
|
28661
|
+
* expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
|
28623
28662
|
* .toBe('');
|
28624
28663
|
*
|
28625
|
-
* container.
|
28664
|
+
* container.element(by.linkText('add')).click();
|
28626
28665
|
*
|
28627
|
-
* expect(container.
|
28628
|
-
* .
|
28666
|
+
* expect(container.element(by.repeater('contact in contacts').row(2))
|
28667
|
+
* .element(by.model('contact.value'))
|
28629
28668
|
* .getAttribute('value'))
|
28630
28669
|
* .toBe('yourname@example.org');
|
28631
28670
|
* });
|
@@ -28996,21 +29035,22 @@ forEach(
|
|
28996
29035
|
* ({@link guide/expression#-event- Event object is available as `$event`})
|
28997
29036
|
*
|
28998
29037
|
* @example
|
28999
|
-
<example>
|
29038
|
+
<example module="submitExample">
|
29000
29039
|
<file name="index.html">
|
29001
29040
|
<script>
|
29002
|
-
|
29003
|
-
$scope
|
29004
|
-
|
29005
|
-
|
29006
|
-
|
29007
|
-
$scope.
|
29008
|
-
|
29009
|
-
|
29010
|
-
|
29011
|
-
|
29041
|
+
angular.module('submitExample', [])
|
29042
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
29043
|
+
$scope.list = [];
|
29044
|
+
$scope.text = 'hello';
|
29045
|
+
$scope.submit = function() {
|
29046
|
+
if ($scope.text) {
|
29047
|
+
$scope.list.push(this.text);
|
29048
|
+
$scope.text = '';
|
29049
|
+
}
|
29050
|
+
};
|
29051
|
+
}]);
|
29012
29052
|
</script>
|
29013
|
-
<form ng-submit="submit()" ng-controller="
|
29053
|
+
<form ng-submit="submit()" ng-controller="ExampleController">
|
29014
29054
|
Enter text and hit enter:
|
29015
29055
|
<input type="text" ng-model="text" name="text" />
|
29016
29056
|
<input type="submit" id="submit" value="Submit" />
|
@@ -29022,7 +29062,7 @@ forEach(
|
|
29022
29062
|
expect(element(by.binding('list')).getText()).toBe('list=[]');
|
29023
29063
|
element(by.css('#submit')).click();
|
29024
29064
|
expect(element(by.binding('list')).getText()).toContain('hello');
|
29025
|
-
expect(element(by.
|
29065
|
+
expect(element(by.model('text')).getAttribute('value')).toBe('');
|
29026
29066
|
});
|
29027
29067
|
it('should ignore empty strings', function() {
|
29028
29068
|
expect(element(by.binding('list')).getText()).toBe('list=[]');
|
@@ -29295,9 +29335,9 @@ var ngIfDirective = ['$animate', function($animate) {
|
|
29295
29335
|
* - Otherwise enable scrolling only if the expression evaluates to truthy value.
|
29296
29336
|
*
|
29297
29337
|
* @example
|
29298
|
-
<example module="
|
29338
|
+
<example module="includeExample" deps="angular-animate.js" animations="true">
|
29299
29339
|
<file name="index.html">
|
29300
|
-
<div ng-controller="
|
29340
|
+
<div ng-controller="ExampleController">
|
29301
29341
|
<select ng-model="template" ng-options="t.name for t in templates">
|
29302
29342
|
<option value="">(blank)</option>
|
29303
29343
|
</select>
|
@@ -29309,12 +29349,13 @@ var ngIfDirective = ['$animate', function($animate) {
|
|
29309
29349
|
</div>
|
29310
29350
|
</file>
|
29311
29351
|
<file name="script.js">
|
29312
|
-
|
29313
|
-
$scope
|
29314
|
-
|
29315
|
-
{ name: '
|
29316
|
-
|
29317
|
-
|
29352
|
+
angular.module('includeExample', ['ngAnimate'])
|
29353
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
29354
|
+
$scope.templates =
|
29355
|
+
[ { name: 'template1.html', url: 'template1.html'},
|
29356
|
+
{ name: 'template2.html', url: 'template2.html'} ];
|
29357
|
+
$scope.template = $scope.templates[0];
|
29358
|
+
}]);
|
29318
29359
|
</file>
|
29319
29360
|
<file name="template1.html">
|
29320
29361
|
Content of template1.html
|
@@ -29377,7 +29418,7 @@ var ngIfDirective = ['$animate', function($animate) {
|
|
29377
29418
|
return;
|
29378
29419
|
}
|
29379
29420
|
templateSelect.click();
|
29380
|
-
templateSelect.
|
29421
|
+
templateSelect.all(by.css('option')).get(2).click();
|
29381
29422
|
expect(includeElem.getText()).toMatch(/Content of template2.html/);
|
29382
29423
|
});
|
29383
29424
|
|
@@ -29387,7 +29428,7 @@ var ngIfDirective = ['$animate', function($animate) {
|
|
29387
29428
|
return;
|
29388
29429
|
}
|
29389
29430
|
templateSelect.click();
|
29390
|
-
templateSelect.
|
29431
|
+
templateSelect.all(by.css('option')).get(0).click();
|
29391
29432
|
expect(includeElem.isPresent()).toBe(false);
|
29392
29433
|
});
|
29393
29434
|
</file>
|
@@ -29539,14 +29580,15 @@ var ngIncludeFillContentDirective = ['$compile',
|
|
29539
29580
|
* @param {expression} ngInit {@link guide/expression Expression} to eval.
|
29540
29581
|
*
|
29541
29582
|
* @example
|
29542
|
-
<example>
|
29583
|
+
<example module="initExample">
|
29543
29584
|
<file name="index.html">
|
29544
29585
|
<script>
|
29545
|
-
|
29546
|
-
|
29547
|
-
|
29586
|
+
angular.module('initExample', [])
|
29587
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
29588
|
+
$scope.list = [['a', 'b'], ['c', 'd']];
|
29589
|
+
}]);
|
29548
29590
|
</script>
|
29549
|
-
<div ng-controller="
|
29591
|
+
<div ng-controller="ExampleController">
|
29550
29592
|
<div ng-repeat="innerList in list" ng-init="outerIndex = $index">
|
29551
29593
|
<div ng-repeat="value in innerList" ng-init="innerIndex = $index">
|
29552
29594
|
<span class="example-init">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>
|
@@ -29699,16 +29741,17 @@ var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });
|
|
29699
29741
|
* @param {number=} offset Offset to deduct from the total number.
|
29700
29742
|
*
|
29701
29743
|
* @example
|
29702
|
-
<example>
|
29744
|
+
<example module="pluralizeExample">
|
29703
29745
|
<file name="index.html">
|
29704
29746
|
<script>
|
29705
|
-
|
29706
|
-
$scope
|
29707
|
-
|
29708
|
-
|
29709
|
-
|
29747
|
+
angular.module('pluralizeExample', [])
|
29748
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
29749
|
+
$scope.person1 = 'Igor';
|
29750
|
+
$scope.person2 = 'Misko';
|
29751
|
+
$scope.personCount = 1;
|
29752
|
+
}]);
|
29710
29753
|
</script>
|
29711
|
-
<div ng-controller="
|
29754
|
+
<div ng-controller="ExampleController">
|
29712
29755
|
Person 1:<input type="text" ng-model="person1" value="Igor" /><br/>
|
29713
29756
|
Person 2:<input type="text" ng-model="person2" value="Misko" /><br/>
|
29714
29757
|
Number of People:<input type="text" ng-model="personCount" value="1" /><br/>
|
@@ -30642,9 +30685,9 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
|
|
30642
30685
|
*
|
30643
30686
|
*
|
30644
30687
|
* @example
|
30645
|
-
<example module="
|
30688
|
+
<example module="switchExample" deps="angular-animate.js" animations="true">
|
30646
30689
|
<file name="index.html">
|
30647
|
-
<div ng-controller="
|
30690
|
+
<div ng-controller="ExampleController">
|
30648
30691
|
<select ng-model="selection" ng-options="item for item in items">
|
30649
30692
|
</select>
|
30650
30693
|
<tt>selection={{selection}}</tt>
|
@@ -30658,10 +30701,11 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
|
|
30658
30701
|
</div>
|
30659
30702
|
</file>
|
30660
30703
|
<file name="script.js">
|
30661
|
-
|
30662
|
-
|
30663
|
-
|
30664
|
-
|
30704
|
+
angular.module('switchExample', ['ngAnimate'])
|
30705
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
30706
|
+
$scope.items = ['settings', 'home', 'other'];
|
30707
|
+
$scope.selection = $scope.items[0];
|
30708
|
+
}]);
|
30665
30709
|
</file>
|
30666
30710
|
<file name="animations.css">
|
30667
30711
|
.animate-switch-container {
|
@@ -30704,11 +30748,11 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
|
|
30704
30748
|
expect(switchElem.getText()).toMatch(/Settings Div/);
|
30705
30749
|
});
|
30706
30750
|
it('should change to home', function() {
|
30707
|
-
select.
|
30751
|
+
select.all(by.css('option')).get(1).click();
|
30708
30752
|
expect(switchElem.getText()).toMatch(/Home Span/);
|
30709
30753
|
});
|
30710
30754
|
it('should select default', function() {
|
30711
|
-
select.
|
30755
|
+
select.all(by.css('option')).get(2).click();
|
30712
30756
|
expect(switchElem.getText()).toMatch(/default/);
|
30713
30757
|
});
|
30714
30758
|
</file>
|
@@ -30800,15 +30844,10 @@ var ngSwitchDefaultDirective = ngDirective({
|
|
30800
30844
|
* @element ANY
|
30801
30845
|
*
|
30802
30846
|
* @example
|
30803
|
-
<example module="
|
30847
|
+
<example module="transcludeExample">
|
30804
30848
|
<file name="index.html">
|
30805
30849
|
<script>
|
30806
|
-
|
30807
|
-
$scope.title = 'Lorem Ipsum';
|
30808
|
-
$scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
|
30809
|
-
}
|
30810
|
-
|
30811
|
-
angular.module('transclude', [])
|
30850
|
+
angular.module('transcludeExample', [])
|
30812
30851
|
.directive('pane', function(){
|
30813
30852
|
return {
|
30814
30853
|
restrict: 'E',
|
@@ -30819,9 +30858,13 @@ var ngSwitchDefaultDirective = ngDirective({
|
|
30819
30858
|
'<div ng-transclude></div>' +
|
30820
30859
|
'</div>'
|
30821
30860
|
};
|
30822
|
-
})
|
30861
|
+
})
|
30862
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
30863
|
+
$scope.title = 'Lorem Ipsum';
|
30864
|
+
$scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
|
30865
|
+
}]);
|
30823
30866
|
</script>
|
30824
|
-
<div ng-controller="
|
30867
|
+
<div ng-controller="ExampleController">
|
30825
30868
|
<input ng-model="title"><br>
|
30826
30869
|
<textarea ng-model="text"></textarea> <br/>
|
30827
30870
|
<pane title="{{title}}">{{text}}</pane>
|
@@ -30980,21 +31023,22 @@ var ngOptionsMinErr = minErr('ngOptions');
|
|
30980
31023
|
* `value` variable (e.g. `value.propertyName`).
|
30981
31024
|
*
|
30982
31025
|
* @example
|
30983
|
-
<example>
|
31026
|
+
<example module="selectExample">
|
30984
31027
|
<file name="index.html">
|
30985
31028
|
<script>
|
30986
|
-
|
30987
|
-
$scope
|
30988
|
-
|
30989
|
-
|
30990
|
-
|
30991
|
-
|
30992
|
-
|
30993
|
-
|
30994
|
-
|
30995
|
-
|
31029
|
+
angular.module('selectExample', [])
|
31030
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
31031
|
+
$scope.colors = [
|
31032
|
+
{name:'black', shade:'dark'},
|
31033
|
+
{name:'white', shade:'light'},
|
31034
|
+
{name:'red', shade:'dark'},
|
31035
|
+
{name:'blue', shade:'dark'},
|
31036
|
+
{name:'yellow', shade:'light'}
|
31037
|
+
];
|
31038
|
+
$scope.myColor = $scope.colors[2]; // red
|
31039
|
+
}]);
|
30996
31040
|
</script>
|
30997
|
-
<div ng-controller="
|
31041
|
+
<div ng-controller="ExampleController">
|
30998
31042
|
<ul>
|
30999
31043
|
<li ng-repeat="color in colors">
|
31000
31044
|
Name: <input ng-model="color.name">
|
@@ -31031,7 +31075,7 @@ var ngOptionsMinErr = minErr('ngOptions');
|
|
31031
31075
|
<file name="protractor.js" type="protractor">
|
31032
31076
|
it('should check ng-options', function() {
|
31033
31077
|
expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('red');
|
31034
|
-
element.all(by.
|
31078
|
+
element.all(by.model('myColor')).first().click();
|
31035
31079
|
element.all(by.css('select[ng-model="myColor"] option')).first().click();
|
31036
31080
|
expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('black');
|
31037
31081
|
element(by.css('.nullable select[ng-model="myColor"]')).click();
|