From 19a910f24cc6302fc953d2f347ef96c10161bbdf Mon Sep 17 00:00:00 2001 From: Ashish Kamble Date: Mon, 25 Feb 2019 12:57:57 +0530 Subject: [PATCH 1/2] Update validators.js --- src/ng/directive/validators.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ng/directive/validators.js b/src/ng/directive/validators.js index 5c1649ecf74e..e929da660af0 100644 --- a/src/ng/directive/validators.js +++ b/src/ng/directive/validators.js @@ -68,9 +68,11 @@ var requiredDirective = ['$parse', function($parse) { require: '?ngModel', link: function(scope, elm, attr, ctrl) { if (!ctrl) return; - var value = attr.required || $parse(attr.ngRequired)(scope); + var value = 'required' in attr || $parse(attr.ngRequired)(scope); - attr.required = true; // force truthy in case we are on non input element + if (!attr.ngRequired) { + attr.required = true; + } // force truthy in case we are on non input element ctrl.$validators.required = function(modelValue, viewValue) { return !value || !ctrl.$isEmpty(viewValue); From c2df57594ef7e29ab49f943465aa15258415b220 Mon Sep 17 00:00:00 2001 From: Ashish Kamble Date: Tue, 5 Mar 2019 11:52:06 +0530 Subject: [PATCH 2/2] docs(di): update docs content --- docs/content/guide/di.ngdoc | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/content/guide/di.ngdoc b/docs/content/guide/di.ngdoc index f0ac64c8c290..9a8ac08e1ae4 100644 --- a/docs/content/guide/di.ngdoc +++ b/docs/content/guide/di.ngdoc @@ -284,6 +284,7 @@ Here is an example of using the injector service: var myModule = angular.module('myModule', []); ``` +Notice that `myModule` depends upon no other modules as the second parameter is an empty array. Teach the injector how to build a `greeter` service. Notice that `greeter` is dependent on the `$window` service. The `greeter` service is an object that contains a `greet` method.