Skip to content

Instantly share code, notes, and snippets.

@Greenie0506
Last active June 28, 2016 23:14
Show Gist options
  • Save Greenie0506/aad74e7a67a9fec225b961b65b841926 to your computer and use it in GitHub Desktop.
Save Greenie0506/aad74e7a67a9fec225b961b65b841926 to your computer and use it in GitHub Desktop.
$scope.$watch(
'feed',
function(
newVal,
oldVal
) {
$scope.form.changed = ( newVal != oldVal ) ?
true :
$scope.form.changed;
},
true
);
@jordanorelli
Copy link

i'd probably write it like this

$scope.$watch('feed', function(newVal, oldVal) {
  $scope.form.changed = ( newVal != oldVal ) ? true : $scope.form.changed;
}, true);

but that ternary is totally extraneous. this is the same:

$scope.$watch('feed', function(newVal, oldVal) {
  $scope.form.changed = newVal != oldVal;
}, true);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment