i am new to angular and i have a couple text fields, a checkbox, and a drop down how can i make it so that i can press the enter button and it would submit? i been reading and found the ng-submit function, i placed this in my form but nothing happens i am assuming i am going to have to activate it somewhere in my angular controller.
<form ng-submit="search()">
<div class="form-group">
<label>Job Number</label>
<input class="form-control" style="width: 92%" type="text" ng-model="jobNumber"/>
</div>
</form>
<form ng-submit="search()">
<div class="form-group">
<label>Description</label>
<input class="form-control" style="width: 92%" type="text" ng-model="description" />
</div>
</form>
</div>
</div>
and i didnt do anything in my controller which is below.
var CapitalRequestMultiMillInquiryController = function ($scope, $sce, $rootScope, $modal, $window, CapitalRequestService, PlantService) {
$rootScope.title = 'Capital Request Multi Mill Inquiry';
$scope.allMills = [];
$scope.mill = '';
$scope.jobNumber = '';
$scope.description = '';
$scope.amount = '';
$scope.amountOperator = '';
$scope.openOnly = '';
$scope.projectManager = '';
//$scope.allUsers = [];
//UsersService.getUsersWithId().then(function(objectTypes) {
// $scope.allUsers = objectTypes
//});
//CapitalRequestService.searchMulti("http://tomcmmsweb.pca.com/CapitalRequest/Search", authenticatedUser.userName.toUpperCase(), $scope.selectedMill, $scope.jobNumber, $scope.description, $scope.amount, $scope.amountOperator, $scope.openOnly, $scope.projectManager).then(function (results) {
// $scope.tomahawk = results;
// for (var i = 0; i < $scope.tomahawk.length; i++)
// $scope.tomahawk[i] = $sce.trustAsHTML($scope.tomahawk[i]);
//});
PlantService.getPlantId().then(function (mills) {
$scope.allMills = mills
});
$scope.search = function() {
//for each mill
CapitalRequestService.searchMulti("http://coucmmsweb.pca.com/CapitalRequest/Search", authenticatedUser.userName.toUpperCase(), $scope.mill, $scope.jobNumber, $scope.description, $scope.amount, $scope.amountOperator, $scope.openOnly, $scope.projectManager).then(function (results) {
$scope.counce = results;
$scope.counce.forEach(function (item) {
// item.projectManager = $sce.trustAsHtml(item.projectManager);
item.jobNumber = $sce.trustAsHtml(item.jobNumber);
item.description = $sce.trustAsHtml(item.description);
item.amount = $sce.trustAsHtml(item.amount);
});
});
CapitalRequestService.searchMulti("http://filcmmsweb.pca.com/CapitalRequest/Search", authenticatedUser.userName.toUpperCase(), $scope.mill, $scope.jobNumber, $scope.description, $scope.amount, $scope.amountOperator, $scope.openOnly, $scope.projectManager).then(function (results) {
$scope.filer = results;
$scope.filer.forEach(function (item) {
// item.projectManager = $sce.trustAsHtml(item.projectManager);
item.jobNumber = $sce.trustAsHtml(item.jobNumber);
item.description = $sce.trustAsHtml(item.description);
item.amount = $sce.trustAsHtml(item.amount);
});
});
CapitalRequestService.searchMulti("http://tomcmmsweb.pca.com/CapitalRequest/Search", authenticatedUser.userName.toUpperCase(), $scope.mill, $scope.jobNumber, $scope.description, $scope.amount, $scope.amountOperator, $scope.openOnly, $scope.projectManager).then(function (results) {
$scope.tomahawk = results;
$scope.tomahawk.forEach(function (item) {
// item.projectManager = $sce.trustAsHtml(item.projectManager);
item.jobNumber = $sce.trustAsHtml(item.jobNumber);
item.description = $sce.trustAsHtml(item.description);
item.amount = $sce.trustAsHtml(item.amount);
});
});
CapitalRequestService.searchMulti("http://tridentval.pca.com/api/Inquiry/Inquiry/CapitalRequestMultiMillInquiry/Search", authenticatedUser.userName.toUpperCase(), $scope.mill, $scope.jobNumber, $scope.description, $scope.amount, $scope.amountOperator, $scope.openOnly, $scope.projectManager).then(function (results) {
$scope.valdosta = results;
});
CapitalRequestService.searchMulti("http://tridentder.pca.com/api/Inquiry/Inquiry/CapitalRequestMultiMillInquiry/Search", authenticatedUser.userName.toUpperCase(), $scope.mill, $scope.jobNumber, $scope.description, $scope.amount, $scope.amountOperator, $scope.openOnly, $scope.projectManager).then(function (results) {
$scope.deridder = results;
});
CapitalRequestService.searchMulti("http://valcmmsweb.pca.com/CapitalRequest/Search", authenticatedUser.userName.toUpperCase(), $scope.mill, $scope.jobNumber, $scope.description, $scope.amount, $scope.amountOperator, $scope.openOnly, $scope.projectManager).then(function (results) {
$scope.whiteMills = results;
$scope.whiteMills.forEach(function (item) {
item.jobNumber = $sce.trustAsHtml(item.jobNumber);
item.description = $sce.trustAsHtml(item.description);
item.amount = $sce.trustAsHtml(item.amount);
});
});
}
};