Commit 07fd92fc authored by Pascal Hartig's avatar Pascal Hartig

AngularJS: Upgrade to 1.3.11

parent b81d5c1c
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
"name": "todomvc-angular", "name": "todomvc-angular",
"version": "0.0.0", "version": "0.0.0",
"dependencies": { "dependencies": {
"angular": "1.3.10", "angular": "1.3.11",
"todomvc-common": "~0.3.0" "todomvc-common": "~0.3.0"
}, },
"devDependencies": { "devDependencies": {
"angular-mocks": "1.3.10", "angular-mocks": "1.3.11",
"angular-route": "1.3.10" "angular-route": "1.3.11"
} }
} }
/** /**
* @license AngularJS v1.3.10 * @license AngularJS v1.3.11
* (c) 2010-2014 Google, Inc. http://angularjs.org * (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT * License: MIT
*/ */
......
/** /**
* @license AngularJS v1.3.10 * @license AngularJS v1.3.11
* (c) 2010-2014 Google, Inc. http://angularjs.org * (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT * License: MIT
*/ */
...@@ -54,7 +54,7 @@ function minErr(module, ErrorConstructor) { ...@@ -54,7 +54,7 @@ function minErr(module, ErrorConstructor) {
return match; return match;
}); });
message = message + '\nhttp://errors.angularjs.org/1.3.10/' + message = message + '\nhttp://errors.angularjs.org/1.3.11/' +
(module ? module + '/' : '') + code; (module ? module + '/' : '') + code;
for (i = 2; i < arguments.length; i++) { for (i = 2; i < arguments.length; i++) {
message = message + (i == 2 ? '?' : '&') + 'p' + (i - 2) + '=' + message = message + (i == 2 ? '?' : '&') + 'p' + (i - 2) + '=' +
...@@ -2118,11 +2118,11 @@ function toDebugString(obj) { ...@@ -2118,11 +2118,11 @@ function toDebugString(obj) {
* - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat". * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
*/ */
var version = { var version = {
full: '1.3.10', // all of these placeholder strings will be replaced by grunt's full: '1.3.11', // all of these placeholder strings will be replaced by grunt's
major: 1, // package task major: 1, // package task
minor: 3, minor: 3,
dot: 10, dot: 11,
codeName: 'heliotropic-sundial' codeName: 'spiffy-manatee'
}; };
...@@ -11320,7 +11320,7 @@ function $LocationProvider() { ...@@ -11320,7 +11320,7 @@ function $LocationProvider() {
// TODO(vojta): rewrite link when opening in new tab/window (in legacy browser) // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)
// currently we open nice url link and redirect then // currently we open nice url link and redirect then
if (!html5Mode.rewriteLinks || event.ctrlKey || event.metaKey || event.which == 2) return; if (!html5Mode.rewriteLinks || event.ctrlKey || event.metaKey || event.shiftKey || event.which == 2 || event.button == 2) return;
var elm = jqLite(event.target); var elm = jqLite(event.target);
...@@ -17665,6 +17665,9 @@ var htmlAnchorDirective = valueFn({ ...@@ -17665,6 +17665,9 @@ var htmlAnchorDirective = valueFn({
compile: function(element, attr) { compile: function(element, attr) {
if (!attr.href && !attr.xlinkHref && !attr.name) { if (!attr.href && !attr.xlinkHref && !attr.name) {
return function(scope, element) { return function(scope, element) {
// If the linked element is not an anchor tag anymore, do nothing
if (element[0].nodeName.toLowerCase() !== 'a') return;
// SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute. // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.
var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ? var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ?
'xlink:href' : 'href'; 'xlink:href' : 'href';
...@@ -18683,19 +18686,21 @@ var inputType = { ...@@ -18683,19 +18686,21 @@ var inputType = {
<script> <script>
angular.module('textInputExample', []) angular.module('textInputExample', [])
.controller('ExampleController', ['$scope', function($scope) { .controller('ExampleController', ['$scope', function($scope) {
$scope.text = 'guest'; $scope.example = {
$scope.word = /^\s*\w*\s*$/; text: 'guest',
word: /^\s*\w*\s*$/
};
}]); }]);
</script> </script>
<form name="myForm" ng-controller="ExampleController"> <form name="myForm" ng-controller="ExampleController">
Single word: <input type="text" name="input" ng-model="text" Single word: <input type="text" name="input" ng-model="example.text"
ng-pattern="word" required ng-trim="false"> ng-pattern="example.word" required ng-trim="false">
<span class="error" ng-show="myForm.input.$error.required"> <span class="error" ng-show="myForm.input.$error.required">
Required!</span> Required!</span>
<span class="error" ng-show="myForm.input.$error.pattern"> <span class="error" ng-show="myForm.input.$error.pattern">
Single word only!</span> Single word only!</span>
<tt>text = {{text}}</tt><br/> <tt>text = {{example.text}}</tt><br/>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
...@@ -18703,9 +18708,9 @@ var inputType = { ...@@ -18703,9 +18708,9 @@ var inputType = {
</form> </form>
</file> </file>
<file name="protractor.js" type="protractor"> <file name="protractor.js" type="protractor">
var text = element(by.binding('text')); var text = element(by.binding('example.text'));
var valid = element(by.binding('myForm.input.$valid')); var valid = element(by.binding('myForm.input.$valid'));
var input = element(by.model('text')); var input = element(by.model('example.text'));
it('should initialize to model', function() { it('should initialize to model', function() {
expect(text.getText()).toContain('guest'); expect(text.getText()).toContain('guest');
...@@ -18767,18 +18772,20 @@ var inputType = { ...@@ -18767,18 +18772,20 @@ var inputType = {
<script> <script>
angular.module('dateInputExample', []) angular.module('dateInputExample', [])
.controller('DateController', ['$scope', function($scope) { .controller('DateController', ['$scope', function($scope) {
$scope.value = new Date(2013, 9, 22); $scope.example = {
value: new Date(2013, 9, 22)
};
}]); }]);
</script> </script>
<form name="myForm" ng-controller="DateController as dateCtrl"> <form name="myForm" ng-controller="DateController as dateCtrl">
Pick a date in 2013: Pick a date in 2013:
<input type="date" id="exampleInput" name="input" ng-model="value" <input type="date" id="exampleInput" name="input" ng-model="example.value"
placeholder="yyyy-MM-dd" min="2013-01-01" max="2013-12-31" required /> placeholder="yyyy-MM-dd" min="2013-01-01" max="2013-12-31" required />
<span class="error" ng-show="myForm.input.$error.required"> <span class="error" ng-show="myForm.input.$error.required">
Required!</span> Required!</span>
<span class="error" ng-show="myForm.input.$error.date"> <span class="error" ng-show="myForm.input.$error.date">
Not a valid date!</span> Not a valid date!</span>
<tt>value = {{value | date: "yyyy-MM-dd"}}</tt><br/> <tt>value = {{example.value | date: "yyyy-MM-dd"}}</tt><br/>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
...@@ -18786,9 +18793,9 @@ var inputType = { ...@@ -18786,9 +18793,9 @@ var inputType = {
</form> </form>
</file> </file>
<file name="protractor.js" type="protractor"> <file name="protractor.js" type="protractor">
var value = element(by.binding('value | date: "yyyy-MM-dd"')); var value = element(by.binding('example.value | date: "yyyy-MM-dd"'));
var valid = element(by.binding('myForm.input.$valid')); var valid = element(by.binding('myForm.input.$valid'));
var input = element(by.model('value')); var input = element(by.model('example.value'));
// currently protractor/webdriver does not support // currently protractor/webdriver does not support
// sending keys to all known HTML5 input controls // sending keys to all known HTML5 input controls
...@@ -18858,18 +18865,20 @@ var inputType = { ...@@ -18858,18 +18865,20 @@ var inputType = {
<script> <script>
angular.module('dateExample', []) angular.module('dateExample', [])
.controller('DateController', ['$scope', function($scope) { .controller('DateController', ['$scope', function($scope) {
$scope.value = new Date(2010, 11, 28, 14, 57); $scope.example = {
value: new Date(2010, 11, 28, 14, 57)
};
}]); }]);
</script> </script>
<form name="myForm" ng-controller="DateController as dateCtrl"> <form name="myForm" ng-controller="DateController as dateCtrl">
Pick a date between in 2013: Pick a date between in 2013:
<input type="datetime-local" id="exampleInput" name="input" ng-model="value" <input type="datetime-local" id="exampleInput" name="input" ng-model="example.value"
placeholder="yyyy-MM-ddTHH:mm:ss" min="2001-01-01T00:00:00" max="2013-12-31T00:00:00" required /> placeholder="yyyy-MM-ddTHH:mm:ss" min="2001-01-01T00:00:00" max="2013-12-31T00:00:00" required />
<span class="error" ng-show="myForm.input.$error.required"> <span class="error" ng-show="myForm.input.$error.required">
Required!</span> Required!</span>
<span class="error" ng-show="myForm.input.$error.datetimelocal"> <span class="error" ng-show="myForm.input.$error.datetimelocal">
Not a valid date!</span> Not a valid date!</span>
<tt>value = {{value | date: "yyyy-MM-ddTHH:mm:ss"}}</tt><br/> <tt>value = {{example.value | date: "yyyy-MM-ddTHH:mm:ss"}}</tt><br/>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
...@@ -18877,9 +18886,9 @@ var inputType = { ...@@ -18877,9 +18886,9 @@ var inputType = {
</form> </form>
</file> </file>
<file name="protractor.js" type="protractor"> <file name="protractor.js" type="protractor">
var value = element(by.binding('value | date: "yyyy-MM-ddTHH:mm:ss"')); var value = element(by.binding('example.value | date: "yyyy-MM-ddTHH:mm:ss"'));
var valid = element(by.binding('myForm.input.$valid')); var valid = element(by.binding('myForm.input.$valid'));
var input = element(by.model('value')); var input = element(by.model('example.value'));
// currently protractor/webdriver does not support // currently protractor/webdriver does not support
// sending keys to all known HTML5 input controls // sending keys to all known HTML5 input controls
...@@ -18950,18 +18959,20 @@ var inputType = { ...@@ -18950,18 +18959,20 @@ var inputType = {
<script> <script>
angular.module('timeExample', []) angular.module('timeExample', [])
.controller('DateController', ['$scope', function($scope) { .controller('DateController', ['$scope', function($scope) {
$scope.value = new Date(1970, 0, 1, 14, 57, 0); $scope.example = {
value: new Date(1970, 0, 1, 14, 57, 0)
};
}]); }]);
</script> </script>
<form name="myForm" ng-controller="DateController as dateCtrl"> <form name="myForm" ng-controller="DateController as dateCtrl">
Pick a between 8am and 5pm: Pick a between 8am and 5pm:
<input type="time" id="exampleInput" name="input" ng-model="value" <input type="time" id="exampleInput" name="input" ng-model="example.value"
placeholder="HH:mm:ss" min="08:00:00" max="17:00:00" required /> placeholder="HH:mm:ss" min="08:00:00" max="17:00:00" required />
<span class="error" ng-show="myForm.input.$error.required"> <span class="error" ng-show="myForm.input.$error.required">
Required!</span> Required!</span>
<span class="error" ng-show="myForm.input.$error.time"> <span class="error" ng-show="myForm.input.$error.time">
Not a valid date!</span> Not a valid date!</span>
<tt>value = {{value | date: "HH:mm:ss"}}</tt><br/> <tt>value = {{example.value | date: "HH:mm:ss"}}</tt><br/>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
...@@ -18969,9 +18980,9 @@ var inputType = { ...@@ -18969,9 +18980,9 @@ var inputType = {
</form> </form>
</file> </file>
<file name="protractor.js" type="protractor"> <file name="protractor.js" type="protractor">
var value = element(by.binding('value | date: "HH:mm:ss"')); var value = element(by.binding('example.value | date: "HH:mm:ss"'));
var valid = element(by.binding('myForm.input.$valid')); var valid = element(by.binding('myForm.input.$valid'));
var input = element(by.model('value')); var input = element(by.model('example.value'));
// currently protractor/webdriver does not support // currently protractor/webdriver does not support
// sending keys to all known HTML5 input controls // sending keys to all known HTML5 input controls
...@@ -19041,18 +19052,20 @@ var inputType = { ...@@ -19041,18 +19052,20 @@ var inputType = {
<script> <script>
angular.module('weekExample', []) angular.module('weekExample', [])
.controller('DateController', ['$scope', function($scope) { .controller('DateController', ['$scope', function($scope) {
$scope.value = new Date(2013, 0, 3); $scope.example = {
value: new Date(2013, 0, 3)
};
}]); }]);
</script> </script>
<form name="myForm" ng-controller="DateController as dateCtrl"> <form name="myForm" ng-controller="DateController as dateCtrl">
Pick a date between in 2013: Pick a date between in 2013:
<input id="exampleInput" type="week" name="input" ng-model="value" <input id="exampleInput" type="week" name="input" ng-model="example.value"
placeholder="YYYY-W##" min="2012-W32" max="2013-W52" required /> placeholder="YYYY-W##" min="2012-W32" max="2013-W52" required />
<span class="error" ng-show="myForm.input.$error.required"> <span class="error" ng-show="myForm.input.$error.required">
Required!</span> Required!</span>
<span class="error" ng-show="myForm.input.$error.week"> <span class="error" ng-show="myForm.input.$error.week">
Not a valid date!</span> Not a valid date!</span>
<tt>value = {{value | date: "yyyy-Www"}}</tt><br/> <tt>value = {{example.value | date: "yyyy-Www"}}</tt><br/>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
...@@ -19060,9 +19073,9 @@ var inputType = { ...@@ -19060,9 +19073,9 @@ var inputType = {
</form> </form>
</file> </file>
<file name="protractor.js" type="protractor"> <file name="protractor.js" type="protractor">
var value = element(by.binding('value | date: "yyyy-Www"')); var value = element(by.binding('example.value | date: "yyyy-Www"'));
var valid = element(by.binding('myForm.input.$valid')); var valid = element(by.binding('myForm.input.$valid'));
var input = element(by.model('value')); var input = element(by.model('example.value'));
// currently protractor/webdriver does not support // currently protractor/webdriver does not support
// sending keys to all known HTML5 input controls // sending keys to all known HTML5 input controls
...@@ -19132,18 +19145,20 @@ var inputType = { ...@@ -19132,18 +19145,20 @@ var inputType = {
<script> <script>
angular.module('monthExample', []) angular.module('monthExample', [])
.controller('DateController', ['$scope', function($scope) { .controller('DateController', ['$scope', function($scope) {
$scope.value = new Date(2013, 9, 1); $scope.example = {
value: new Date(2013, 9, 1)
};
}]); }]);
</script> </script>
<form name="myForm" ng-controller="DateController as dateCtrl"> <form name="myForm" ng-controller="DateController as dateCtrl">
Pick a month int 2013: Pick a month in 2013:
<input id="exampleInput" type="month" name="input" ng-model="value" <input id="exampleInput" type="month" name="input" ng-model="example.value"
placeholder="yyyy-MM" min="2013-01" max="2013-12" required /> placeholder="yyyy-MM" min="2013-01" max="2013-12" required />
<span class="error" ng-show="myForm.input.$error.required"> <span class="error" ng-show="myForm.input.$error.required">
Required!</span> Required!</span>
<span class="error" ng-show="myForm.input.$error.month"> <span class="error" ng-show="myForm.input.$error.month">
Not a valid month!</span> Not a valid month!</span>
<tt>value = {{value | date: "yyyy-MM"}}</tt><br/> <tt>value = {{example.value | date: "yyyy-MM"}}</tt><br/>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
...@@ -19151,9 +19166,9 @@ var inputType = { ...@@ -19151,9 +19166,9 @@ var inputType = {
</form> </form>
</file> </file>
<file name="protractor.js" type="protractor"> <file name="protractor.js" type="protractor">
var value = element(by.binding('value | date: "yyyy-MM"')); var value = element(by.binding('example.value | date: "yyyy-MM"'));
var valid = element(by.binding('myForm.input.$valid')); var valid = element(by.binding('myForm.input.$valid'));
var input = element(by.model('value')); var input = element(by.model('example.value'));
// currently protractor/webdriver does not support // currently protractor/webdriver does not support
// sending keys to all known HTML5 input controls // sending keys to all known HTML5 input controls
...@@ -19229,17 +19244,19 @@ var inputType = { ...@@ -19229,17 +19244,19 @@ var inputType = {
<script> <script>
angular.module('numberExample', []) angular.module('numberExample', [])
.controller('ExampleController', ['$scope', function($scope) { .controller('ExampleController', ['$scope', function($scope) {
$scope.value = 12; $scope.example = {
value: 12
};
}]); }]);
</script> </script>
<form name="myForm" ng-controller="ExampleController"> <form name="myForm" ng-controller="ExampleController">
Number: <input type="number" name="input" ng-model="value" Number: <input type="number" name="input" ng-model="example.value"
min="0" max="99" required> min="0" max="99" required>
<span class="error" ng-show="myForm.input.$error.required"> <span class="error" ng-show="myForm.input.$error.required">
Required!</span> Required!</span>
<span class="error" ng-show="myForm.input.$error.number"> <span class="error" ng-show="myForm.input.$error.number">
Not valid number!</span> Not valid number!</span>
<tt>value = {{value}}</tt><br/> <tt>value = {{example.value}}</tt><br/>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
...@@ -19247,9 +19264,9 @@ var inputType = { ...@@ -19247,9 +19264,9 @@ var inputType = {
</form> </form>
</file> </file>
<file name="protractor.js" type="protractor"> <file name="protractor.js" type="protractor">
var value = element(by.binding('value')); var value = element(by.binding('example.value'));
var valid = element(by.binding('myForm.input.$valid')); var valid = element(by.binding('myForm.input.$valid'));
var input = element(by.model('value')); var input = element(by.model('example.value'));
it('should initialize to model', function() { it('should initialize to model', function() {
expect(value.getText()).toContain('12'); expect(value.getText()).toContain('12');
...@@ -19317,16 +19334,18 @@ var inputType = { ...@@ -19317,16 +19334,18 @@ var inputType = {
<script> <script>
angular.module('urlExample', []) angular.module('urlExample', [])
.controller('ExampleController', ['$scope', function($scope) { .controller('ExampleController', ['$scope', function($scope) {
$scope.text = 'http://google.com'; $scope.url = {
text: 'http://google.com'
};
}]); }]);
</script> </script>
<form name="myForm" ng-controller="ExampleController"> <form name="myForm" ng-controller="ExampleController">
URL: <input type="url" name="input" ng-model="text" required> URL: <input type="url" name="input" ng-model="url.text" required>
<span class="error" ng-show="myForm.input.$error.required"> <span class="error" ng-show="myForm.input.$error.required">
Required!</span> Required!</span>
<span class="error" ng-show="myForm.input.$error.url"> <span class="error" ng-show="myForm.input.$error.url">
Not valid url!</span> Not valid url!</span>
<tt>text = {{text}}</tt><br/> <tt>text = {{url.text}}</tt><br/>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
...@@ -19335,9 +19354,9 @@ var inputType = { ...@@ -19335,9 +19354,9 @@ var inputType = {
</form> </form>
</file> </file>
<file name="protractor.js" type="protractor"> <file name="protractor.js" type="protractor">
var text = element(by.binding('text')); var text = element(by.binding('url.text'));
var valid = element(by.binding('myForm.input.$valid')); var valid = element(by.binding('myForm.input.$valid'));
var input = element(by.model('text')); var input = element(by.model('url.text'));
it('should initialize to model', function() { it('should initialize to model', function() {
expect(text.getText()).toContain('http://google.com'); expect(text.getText()).toContain('http://google.com');
...@@ -19406,16 +19425,18 @@ var inputType = { ...@@ -19406,16 +19425,18 @@ var inputType = {
<script> <script>
angular.module('emailExample', []) angular.module('emailExample', [])
.controller('ExampleController', ['$scope', function($scope) { .controller('ExampleController', ['$scope', function($scope) {
$scope.text = 'me@example.com'; $scope.email = {
text: 'me@example.com'
};
}]); }]);
</script> </script>
<form name="myForm" ng-controller="ExampleController"> <form name="myForm" ng-controller="ExampleController">
Email: <input type="email" name="input" ng-model="text" required> Email: <input type="email" name="input" ng-model="email.text" required>
<span class="error" ng-show="myForm.input.$error.required"> <span class="error" ng-show="myForm.input.$error.required">
Required!</span> Required!</span>
<span class="error" ng-show="myForm.input.$error.email"> <span class="error" ng-show="myForm.input.$error.email">
Not valid email!</span> Not valid email!</span>
<tt>text = {{text}}</tt><br/> <tt>text = {{email.text}}</tt><br/>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
...@@ -19424,9 +19445,9 @@ var inputType = { ...@@ -19424,9 +19445,9 @@ var inputType = {
</form> </form>
</file> </file>
<file name="protractor.js" type="protractor"> <file name="protractor.js" type="protractor">
var text = element(by.binding('text')); var text = element(by.binding('email.text'));
var valid = element(by.binding('myForm.input.$valid')); var valid = element(by.binding('myForm.input.$valid'));
var input = element(by.model('text')); var input = element(by.model('email.text'));
it('should initialize to model', function() { it('should initialize to model', function() {
expect(text.getText()).toContain('me@example.com'); expect(text.getText()).toContain('me@example.com');
...@@ -19473,7 +19494,9 @@ var inputType = { ...@@ -19473,7 +19494,9 @@ var inputType = {
<script> <script>
angular.module('radioExample', []) angular.module('radioExample', [])
.controller('ExampleController', ['$scope', function($scope) { .controller('ExampleController', ['$scope', function($scope) {
$scope.color = 'blue'; $scope.color = {
name: 'blue'
};
$scope.specialValue = { $scope.specialValue = {
"id": "12345", "id": "12345",
"value": "green" "value": "green"
...@@ -19481,20 +19504,20 @@ var inputType = { ...@@ -19481,20 +19504,20 @@ var inputType = {
}]); }]);
</script> </script>
<form name="myForm" ng-controller="ExampleController"> <form name="myForm" ng-controller="ExampleController">
<input type="radio" ng-model="color" value="red"> Red <br/> <input type="radio" ng-model="color.name" value="red"> Red <br/>
<input type="radio" ng-model="color" ng-value="specialValue"> Green <br/> <input type="radio" ng-model="color.name" ng-value="specialValue"> Green <br/>
<input type="radio" ng-model="color" value="blue"> Blue <br/> <input type="radio" ng-model="color.name" value="blue"> Blue <br/>
<tt>color = {{color | json}}</tt><br/> <tt>color = {{color.name | json}}</tt><br/>
</form> </form>
Note that `ng-value="specialValue"` sets radio item's value to be the value of `$scope.specialValue`. Note that `ng-value="specialValue"` sets radio item's value to be the value of `$scope.specialValue`.
</file> </file>
<file name="protractor.js" type="protractor"> <file name="protractor.js" type="protractor">
it('should change state', function() { it('should change state', function() {
var color = element(by.binding('color')); var color = element(by.binding('color.name'));
expect(color.getText()).toContain('blue'); expect(color.getText()).toContain('blue');
element.all(by.model('color')).get(0).click(); element.all(by.model('color.name')).get(0).click();
expect(color.getText()).toContain('red'); expect(color.getText()).toContain('red');
}); });
...@@ -19524,28 +19547,30 @@ var inputType = { ...@@ -19524,28 +19547,30 @@ var inputType = {
<script> <script>
angular.module('checkboxExample', []) angular.module('checkboxExample', [])
.controller('ExampleController', ['$scope', function($scope) { .controller('ExampleController', ['$scope', function($scope) {
$scope.value1 = true; $scope.checkboxModel = {
$scope.value2 = 'YES' value1 : true,
value2 : 'YES'
};
}]); }]);
</script> </script>
<form name="myForm" ng-controller="ExampleController"> <form name="myForm" ng-controller="ExampleController">
Value1: <input type="checkbox" ng-model="value1"> <br/> Value1: <input type="checkbox" ng-model="checkboxModel.value1"> <br/>
Value2: <input type="checkbox" ng-model="value2" Value2: <input type="checkbox" ng-model="checkboxModel.value2"
ng-true-value="'YES'" ng-false-value="'NO'"> <br/> ng-true-value="'YES'" ng-false-value="'NO'"> <br/>
<tt>value1 = {{value1}}</tt><br/> <tt>value1 = {{checkboxModel.value1}}</tt><br/>
<tt>value2 = {{value2}}</tt><br/> <tt>value2 = {{checkboxModel.value2}}</tt><br/>
</form> </form>
</file> </file>
<file name="protractor.js" type="protractor"> <file name="protractor.js" type="protractor">
it('should change state', function() { it('should change state', function() {
var value1 = element(by.binding('value1')); var value1 = element(by.binding('checkboxModel.value1'));
var value2 = element(by.binding('value2')); var value2 = element(by.binding('checkboxModel.value2'));
expect(value1.getText()).toContain('true'); expect(value1.getText()).toContain('true');
expect(value2.getText()).toContain('YES'); expect(value2.getText()).toContain('YES');
element(by.model('value1')).click(); element(by.model('checkboxModel.value1')).click();
element(by.model('value2')).click(); element(by.model('checkboxModel.value2')).click();
expect(value1.getText()).toContain('false'); expect(value1.getText()).toContain('false');
expect(value2.getText()).toContain('NO'); expect(value2.getText()).toContain('NO');
...@@ -22254,7 +22279,7 @@ var ngIncludeFillContentDirective = ['$compile', ...@@ -22254,7 +22279,7 @@ var ngIncludeFillContentDirective = ['$compile',
* **Note**: If you have assignment in `ngInit` along with {@link ng.$filter `$filter`}, make * **Note**: If you have assignment in `ngInit` along with {@link ng.$filter `$filter`}, make
* sure you have parenthesis for correct precedence: * sure you have parenthesis for correct precedence:
* <pre class="prettyprint"> * <pre class="prettyprint">
* <div ng-init="test1 = (data | orderBy:'name')"></div> * `<div ng-init="test1 = (data | orderBy:'name')"></div>`
* </pre> * </pre>
* </div> * </div>
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment