when user enter texts on textbox {{student.fullname()}} should updated. not working. help?
sample applications
<div ng-app = "mainapp" ng-controller = "studentcontroller"> enter first name: <input type= "text" ng-model = "student.firstname"><br/><br/> enter last name: <input type= "text" ng-model = "student.lastname"><br/><br/> entering: {{student.fullname()}} </div> <script> var mainapp = angular.module("mainapp", []); mainapp.controller('studentcontroller', function($scope){ $scope.student = { firstname: "mahesh", lastname: "parashar", fullname: function() { var studentobject; studentobject = $scope.student; return studentobject.firstname+ " " + studentobject.lastname; } }; }); </script>
screenshot of result:
use lowercase c
controller
mainapp.controller('studentcontroller', function($scope){
Comments
Post a Comment