What Are the differences between ngValue and value? We are open to use value or ngValue and the only difference between two is that the “value” is always “string”, where in “ngValue” you can pass “object”. In the below example, I limited to the age>45 then input field value should beset reset to zero/0 as per my custom scenario. You can update as per your. Set limit in input field AngularJs - ng-value = "(age > 45 ? age = 0 : age)" And < input type = "text" ng-model = "age" ng-maxlength = "2" ng-pattern = "/^[0-9]*$/" ng-value = "(age > 45 ? age = 0 : age)" /> Live Result - https://www.w3schools.com/code/tryit.asp?filename=G9N6GE0EUX7Q
Angular, React, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, TypeScript and Interview Questions Answers