Angularjs 输入文本中的角度Js数据绑定

Angularjs 输入文本中的角度Js数据绑定,angularjs,Angularjs,我想在其他输入框中绑定两个输入框firstname和lastname数据FullName,并且该框是只读的 我可以轻松地将数据绑定到div或span中,但不能绑定到输入框中 我已经添加了我的代码,请建议我这是最好的 var myApp=angular.module('myApp',[]); myApp.controller('studentController',函数($scope){ $scope.student={ 名字:“Mahesh”, 姓:“帕拉萨”, 费用:500, 主题:[{ 名

我想在其他输入框中绑定两个输入框firstnamelastname数据FullName,并且该框是只读的

我可以轻松地将数据绑定到div或span中,但不能绑定到输入框中

我已经添加了我的代码,请建议我这是最好的

var myApp=angular.module('myApp',[]);
myApp.controller('studentController',函数($scope){
$scope.student={
名字:“Mahesh”,
姓:“帕拉萨”,
费用:500,
主题:[{
名称:"物理学",,
分数:70
}, {
名称:"化学",,
分数:80
}, {
名称:“数学”,
马克:65
}],
全名:函数(){
var研究对象;
studentObject=$scope.student;
返回studentObject.firstName+“”+studentObject.lastName;
}
};
}); 

输入您的姓名
您好,您好,



第一个名字 姓 全名
您可以使用
ng model
将两个输入框的值绑定到fullname的输入框。我通过禁用它使其成为只读。不能对输入框使用
ng bind

var myApp=angular.module('myApp',[]);
myApp.controller('studentController',函数($scope){
$scope.student={
名字:“Mahesh”,
姓:“帕拉萨”,
费用:500,
主题:[{
名称:"物理学",,
分数:70
}, {
名称:"化学",,
分数:80
}, {
名称:“数学”,
马克:65
}],
全名:函数(){
var研究对象;
studentObject=$scope.student;
返回studentObject.firstName+“”+studentObject.lastName;
}
};
$scope.$watch('student.firstName+“”+student.lastName',函数(newval,oldval){
$scope.fullname=newval;
});
}); 

输入您的姓名
您好,您好,



第一个名字 姓 全名
如果答案有帮助,请向上投票。:)当时我没有接受答案的权利,但现在我有了,如果答案对你有帮助,你仍然可以接受@PriyankaSankhala@PriyankaSankhala我不认为它被接受,因为除了答案之外没有绿色的记号。