Skip to content

Instantly share code, notes, and snippets.

@erhangundogan
Created September 11, 2013 14:30
Show Gist options
  • Select an option

  • Save erhangundogan/6524456 to your computer and use it in GitHub Desktop.

Select an option

Save erhangundogan/6524456 to your computer and use it in GitHub Desktop.
<!doctype html>
<html ng-app>
<head>
<script src="http://code.angularjs.org/1.2.0-rc.2/angular.min.js"></script>
<script type="text/javascript">
function formLogic($scope) {
$scope.validate = function() {
if ($scope.name && $scope.surname) {
console.log("OK");
} else {
console.log("NOT VALID!");
}
}
}
</script>
</head>
<body>
<div ng-controller="formLogic">
<form>
<input type="text" ng-model="name" placeholder="Enter your name here" />
<input type="text" ng-model="surname" placeholder="Enter your surname here" />
<input type="submit" ng-click="validate()" />
</form>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment