My HTML:
<input type ="text" ng-model="contactid" >
I want to pass the contactId value entered in this box to a function abc() which is called onclick of submit button after the box.
How do I do this?
You can do it like so:
<form ng-controller="formCtrl">     
    <input type="text" name="name" ng-model="inputValue" />
    <button ng-click="abc(inputValue)"></button>
</form>
Or using ng-submit directive:
<form ng-controller="formCtrl" ng-submit="abc(inputValue)">     
    <input type="text" name="name" ng-model="inputValue" />
    <button type="submit"></button>
</form>
And in your formCtrl controller:
.controller('formCtrl', function () {
    $scope.inputValue = null;
    $scope.abc = function (value) {
        console.log(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