This file contains hidden or 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
function getWatchers(root) { | |
root = angular.element(root || document.documentElement); | |
var watcherCount = 0; | |
function getElemWatchers(element) { | |
var isolateWatchers = getWatchersFromScope(element.data().$isolateScope); | |
var scopeWatchers = getWatchersFromScope(element.data().$scope); | |
var watchers = scopeWatchers.concat(isolateWatchers); | |
angular.forEach(element.children(), function (childElement) { | |
watchers = watchers.concat(getElemWatchers(angular.element(childElement))); |
This file contains hidden or 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.directive('validSubmit', ['$parse', function ($parse) { | |
return { | |
// we need a form controller to be on the same element as this directive | |
// in other words: this directive can only be used on a <form> | |
require: 'form', | |
// one time action per form | |
link: function (scope, element, iAttrs, form) { | |
form.$submitted = false; | |
// get a hold of the function that handles submission when form is valid | |
var fn = $parse(iAttrs.validSubmit); |