I'm trying to accept user input from a form. I can successfully access the input and can print the data from the object to the console, but when I attempt to push this object to the array of Objects I have stored in the controller, it doesn't work.
Here is a small snippet of my code:
$scope.dogs = [
{
name: "Blinky",
age: "2",
owner: "Martha Franklin",
vaccinated: "Y"
},
{
name: "Spot",
age: "4",
owner: "Martha Franklin",
vaccinated: "Y"
}];
$scope.dog = {
name: "",
age: "",
owner: "",
vaccinated: ""
};
$scope.savePet = function(){
//console.log($scope.dog.name); This prints the name in the input HTML form
$scope.dogs.push($scope.dog); //THIS DOESN'T STORE IN THE INFORMATION
};
Like I stated previously, I am attempting to push an object onto the end of an array of objects and it just isn't working. This is all happening within the controller of an AngularJS module.
