I thought this task would be straightforward, but for some reason, I am unable to make it work. The only thing I need to do is pass a string to the function.
Here's what I have tried:
<form ng-submit="edit(type)" ng-init="type='debt'">
Additionally, I also attempted:
<div ng-controller="FormCtrl">
<form ng-submit="edit('debt')">
<input type="submit" value="ADD">
</form>
</div>
Checking the JavaScript side of things:
app.controller('FormCtrl', function ($scope, $cookies, $http){
$scope.edit = function(typ){
alert(typ);
}
});
All I am trying to achieve is to display an alert with the word 'debt'. However, instead of that, I keep getting 'undefined'.