Home > Web Front-end > JS Tutorial > Analysis on the usage of general function parameter passing in AngularJS

Analysis on the usage of general function parameter passing in AngularJS

高洛峰
Release: 2016-12-05 16:54:47
Original
1102 people have browsed it

The examples in this article describe the usage of general function parameter passing in AngularJS. Share it with everyone for your reference, the details are as follows:

1. Model parameters

use variable names directly without quotation marks

<!doctype html>
<html ng-app="passAter">
  <head>
    <meta charset="utf-8"/>
  </head>
  <body>
    <div ng-controller="passCtrl">
      <input type="text" ng-model="value"/>
      <button ng-click="alertfun(value)">click</button>
    </div>
  </body>
  <script src="./js/angular.min.js"></script>
  <script>
   angular.module(&#39;passAter&#39;,[]).controller(&#39;passCtrl&#39;,[&#39;$scope&#39;,function($scope){
     $scope.alertfun = function(param){
       alert(param);
     }
   }])
  </script>
</html>
Copy after login

Analysis on the usage of general function parameter passing in AngularJS

2. Ordinary parameters

just add quotation marks

Change the value above If it is 'value'

, the value will pop up directly

I hope this article will be helpful to everyone in AngularJS programming.


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template