fix($observe): check if the attribute is undefined before manually applying the function

Check if the attribute is undefined before manually applying the function because if not an undefined
property is added to the scope of the form controller when the input control does not have a name.

Closes #9707