I'm new to Angular, and I am trying to do something really basic. Here is a part of a view (all angular files are added elsewhere) :
<div ng-controller='ctrl'>
<input type='text' ng-model='id'>
</div>
And here is my controller :
module.controller('ctrl',['$scope', function ($scope) {
// get the scope value here
}]);
What I'm trying to do is really simple. I'd like to use the input value. I tried something like $scope.data = []
and $scope.data.push($scope.id)
to create an array with the scope's value, but it didn't work. When I tried to display the value, I got an 'undefined' on the console.
Do you guys have any idea ?
Edit : The view also has a button with the ng-click
directive which trigger the controller's function where I try to get my value.