I have this code in native javascript and it works all right. it logs the textbox's current value
<script>
    var boom = function(val) {
        console.log(val);
    };
</script>
<input type="text" onclick="boom(this.value)"/>
Then I want to do the same on AngularJS without using model. Here is the code:
$scope.boom = function(val) {
    console.log(val);
};
<input type="text" ng-click="boom(this.value)"/>
But it always logs undefined!
Why?
As I know, this in context of ng-* is a scope.
You may access via boom($event.target.value).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With