Cannot read property of ‘substring’ of null from AngularJS

I am new to AngularJS. Somehow, I got to the point I get to use the substring in AngularJS. However,

type in input fields in text

I already searched lots of stuff, some of them are from stackoverflow. But none of them helped me. What I