I have very basic functionality which is like get text value on click function. I have a text box inside ng-if. But when I am trying to get the value it says 'undeifned
' I red about it and came to know that ng-if create its own scope. So if it is true then why click function is working which is defined in controller.
Both are defined in controller.
plnkr
app.controller('MainCtrl', function($scope) {
$scope.comment="";
$scope.showBox = function (){
$scope.showTextBox = true;
}
$scope.getComment = function (){
alert($scope.comment);
$scope.showTextBox = false;
}
});