I'm learning Angular I made this and it works fine, it's simple:
<span>Your Name:</span><h1>{{Name.first+' '+Name.second}}</h1>
<script>
var app = angular.module('myApp', []);
app.controller('myController', function ($scope) {
$scope.Name = { first: 'First', second: 'Second' };
})
</script>
But I want the controller to read the values from the text inputs, so I made this:
<p>First Name: <input type="text" ng-model="fName" /></p>
<p>Last Name: <input type="text" ng-model="lName" /></p>
<span>Your Name:</span><h1>{{Name.first+' '+Name.second}}</h1>
<script>
var app = angular.module('myApp', []);
app.controller('myController', function ($scope) {
$scope.Name = { first: $scope.fName, second: $scope.sName };
});
</script>
But it doesn't work, I'm beginner enough to be sure that I made it wrong