AngularJ控制器

 AngularJS Controller控制着AngularJS应用程序的数据,AngularJS控制器是JavaScript对象,使用ng-controller定义应用程序控制器,如下例子:

<div ng-app="demo" ng-controller="mycontroller">

firsetName:<input type="text" ng-model="firstName"/><br/>

secondName<input type="text" ng-model="lastName"/></br>

the name is {{firstName+“  ”+lastName}}

</div>

<script>

var app=angular.module("demo",[]);

app.controller("mycontroller",function($scope){

$scope.firstName="qiang";

$scope.lastName="li";

});

</script>

原文地址:https://www.cnblogs.com/VARForrest/p/7777753.html