<! DOCTYPE html>
<meta charset= "Utf-8" >
<meta http-equiv= "x-ua-compatible" content= "Ie=edge" >
<title></title>
<link rel= "stylesheet" href= "" >
<body>
<div ng-app= "myApp" ng-controller= "Myctrl" >
Name: <input type= "text" ng-model= "FirstName" ><br/>
Surname: <input type= "text" ng-model= "LastName" ><br/>
<br/>
Name: {{fullName ()}}
</div>
</body>
<script src= "Http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js" ></script>
<script>
var app = Angular.module ("myApp", []);
App.controller (' Myctrl ', function ($scope) {
$scope. FirstName = "John";
$scope. LastName = "Doe";
$scope. FullName = function () {
Return $scope. FirstName + "" + $scope. LastName;
}
});
</script>
This article is from the "Yan" blog, please be sure to keep this source http://suyanzhu.blog.51cto.com/8050189/1895282
Angularjs Controller method