JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.js"></script>
<div ng-app>
<div ng-controller="formCtrl">
<form ng-submit="checkInputs(searchUser)">
<input type="text" ng-model="searchUser.yourName"><br>
<input type="text" ng-model="searchUser.yourPass">
<input type="submit" class="button">
</form>
{{message}}
</div>
</div>
JavaScript
function formCtrl($scope){
$scope.usersList = [
{
name: 'Alex',
pass: 2200201
},
{
name: 'Michael',
pass: 1231215
},
{
name: 'John',
pass: 1232116
}
];
$scope.checkInputs = function (credentials) {
var auth = false;
angular.forEach($scope.usersList, function(value){
if(value.name == credentials.yourName && value.pass == credentials.yourPass){
auth = true;
}
if(!auth){
$scope.message= "You are not authorized";
}
else
{
$scope.message= "Authorized";
}
});
}
}