You set the $ scope.contact property to a string:
$scope.contact = ""
In your template, you are attached to contact.name here:
<input ng-model="contact.name" type="text" class="form-control">
the string does not have the name property, hence the error. A fix would be to do this:
$scope.contact = { name: "" }
This creates a new object with the name of the property "name" and an empty string as the value of this property.
source share