SoFunction
Updated on 2025-03-10

Share input example in angularJS


<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Unt titled document</title>
</head>
<script src="http://localhost:81/js/">
</script>
<script src="http://localhost:81/js/">
</script>
<body ng-app="Demo">
<div ng-controller="TestCtrl">
    <input type="text" ng-model="a" test />
<button ng-click="show(a)">View</button>
</div>
</body>
<script>
   var app = ('Demo', [], );
('test', function(){<br> //The link of the input directive has the fourth parameter, and there are some methods of $ctrl, you can use it yourself
     var link = function($scope, $element, $attrs, $ctrl){
    ( $ctrl )
       $ctrl.$(function(value){
         return (',');
       });
       $ctrl.$(function(value){
         return (',');
       });
     }
     return {compile: function(){return link},
             require: 'ngModel',
             restrict: 'A'}
   });
   ('TestCtrl', function($scope){
     $ = [];
     //$ = [1,2,3];
     $ = function(v){
       (v);
     }
   });
</script>
</html>