Last active
December 25, 2015 02:29
-
-
Save oliverm2112/6902756 to your computer and use it in GitHub Desktop.
form test JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app = angular.module('MyApp', []); | |
app.controller('MyCtrl', ['$scope', function ($scope) { | |
$scope.model = { | |
test : 'hello' | |
}; | |
$scope.submitForm = function () { | |
alert('Dirty: ' + $scope.theForm.$dirty); | |
theForm.submit(); | |
}; | |
$scope.$watch('theForm.$dirty', function (newVal, oldVal) { | |
if (newVal !== oldVal) { | |
console.log('changed', oldVal, newVal); | |
} | |
}); | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment