I am making my first steps with angular, I just want to simply clear the content of a input text when I click on it. this is the markup
<div ng-app="myApp" ng-controller="myCtrl"> First Name: <input id="123" type="text" ng-click="unsetValue($e)" ng-model="firstName"><br> Last Name: <input id="456" type="text" ng-click="unsetValue($e)" ng-model="lastName"><br> <br> Full Name: {{firstName + " " + lastName}} </div> this is the js in an external file
var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.firstName= "John"; $scope.lastName= "Doe"; $scope.unsetValue = function($event) { console.log($event); } when I click the control, $event is undefined, any idea why?
thanks M
$eventinstead of$eand the answer on the linked post shows the directive source which shows the named$event