How would you react on model changes to trigger some further action? For instance, say you have an input text field called email and you want to trigger or execute some code as soon as a user starts to type in their email.


We can achieve this using $watch function in our controller.

function MyCtrl($scope) {
	$ = "";

	$scope.$watch("email", function(newValue, oldValue) {
		if ($ > 0) {
			console.log("User has started writing into email");


© 2017