I have a controller like this (with a bunch of stuff removed):
function SignupController($scope) {
function isDateOfBirthValid(day, month, year) {
// Process day, month and year and return a bool...
// Also update the view model with the appropriate validation message
}
}
The function isDateOfBirthValid() is used internally by the controller, but I would also like to be able to call it from external code.
(I expect I'll be told this contravenes the Angular pattern, but it really would save me a bunch of time...)
How do I need to change the controller so that I can call this function externally? I can't just move the function outside the controller, because the function modifies the view model's state in a way which is important.