<div ng-app="myApp" ng-controller="llr">
姓<input type="text" ng-model="first"><br>
名<input type="text" ng-model="last"><br>
<br>
姓名:{{first + "" + last}}<br>
姓名:{{fullName()}}
</div>
<script>
var app = angular.module('myApp',[]);
// 控制器 使用$scop对象访问 相当于element中的模板scope.row
app.controller('llr',function($scope){
$scope.first = "JOJO";
$scope.last = "Doe";
$scope.fullName = function () {
return $scope.first +""+ $scope.last;
}
})
</script>
05-24
1332
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-22
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交