AngularJS is an MV* framework that is most suitable for developing single-page applications for clients. It is not a functional library, but a framework used to develop dynamic web pages. It focuses on extending HTML functions, providing dynamic data binding, and it can cooperate with other frameworks (such as JQuery, etc.).
<body ng-app="myNoteApp"><html><div ng-controller="myNoteCtrl"> <p><textarea ng-model="message" cols="40" rows="10" maxlength="100"></textarea></p><p>100/<span ng-bind="left()"></span></p></div></html><script type="text/javascript">var app=angular.module("myNoteApp",[]);app.controller("myNoteCtrl",function($scope){$scope.message = "";//Show the number of changes $scope.left = function() {return 100 - $scope.message.length;};//Clear the text box $scope.clear = function() {$scope.message = "";};//Perform the save operation $scope.save = function() {alert("Note Saved");};});</script></body>Remark:
If there are multiple "textareas" in the same form, you can control it by defining multiple "ng-models"
If you operate different "textarea" in different forms, you can control it by defining multiple "ng-controllers"
But no matter what the case, if you are in the same file, it is best to use only one "ng-app" in the same body.
Supplement: Usage of <textarea> in Angular JS
Recently, the test used to pass the value in textarea to the background, but the background cannot be received. The code is written like this:
<textarea rows="15" ng-model="Notice.content">{{ notice.content }}</textarea>Later I modified it and removed the content between the two textareas and received it in the background. It seems that there are still some mechanisms in Angular JS that need to be clarified.
<textarea rows="15" ng-model="Notice.content"></textarea>