I already saw many questions about this issue, but I didn't understand the answers that were given. I saw several examples of modules and controllers but when I try it, it is not working.
I copied code from a website to check if it will work for me but it is still not working.
This is the code:
var myapp = angular.module("myapp", []);
myapp.controller("HelloCtrl", function($scope) {
$scope.user = {
name: "name123",
nickName: "nickName123",
callMe: function() {
var userObject = $scope.user;
return userObject.name + " Known as " + userObject.nickName;
}
};
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="myapp">
<div ng-controller="HelloCtrl">
<!--הטופס-->
First Name:
<input type="text" ng-model="user.name" />
<br />Last Name:
<input type="text" ng-model="user.nickName" />
<br />
</div>
</div>
{{user.callMe()}}
When I debug the code this is what I get:
