Hi all,
I've built a application with AngularJs and NodeJs, view template EJS.
When I render a page, I set value of input (ng-model) and I want to get that model in controller but I can't get it.
This is my file EJS:
<!DOCTYPE html>
<html ng-app='test'>
<head>
<script src="/angular/angular.js"></script>
<link rel='stylesheet' href='/stylesheets/style.css' />
</head>
<body ng-controller='testCtrl'>
<input type="text" ng-model='testModel' ng-change='change()' ng-init="testModel ='John'">
</body>
</html>
<script>
var testApp = angular.module('test', []);
testApp.controller('testCtrl', function($scope){
$scope.change = function(){
console.log($scope.testModel);
};
console.log($scope.testModel);
});
</script>
Anyone can help me please?
Thanks and Best Regards,