I am looking for solution for a problem which might not exist the way I am trying to do it. So if anyone can help me with the best way of doing this.
ISSUE:
I have the following input field:
<input type="text" placeholder="quote" ng-model="person.quotes.quote">
<input type="text" placeholder="author" ng-model="person.author">
<input type="text" placeholder="category" ng-model="person.category">
And I have the following object:
$scope.person = {
author: $scope.author,
category: $scope.category,
quotes: [{quote: $scope.quote}]
};
I am trying to get the value person.quote into the array of quotes. But I can't seem to do it.
REASON:
The reason why I am doing this is that when a user fills the input fields and clicks on a button the values are saved into the $scope.person object. And that I push that entire object to my firebase API. I want to maintain the structure of my $scope.person object as I have described in my javascript the same in my firebase API. I can easily push author and category but the nested quotes objects are not being pushed.
THE ERROR I GET:
Error: Firebase.set failed: First argument contains undefined in property 'quotes.0.quote'
Thanks in advance and if this information is not enough please let me know so i can provide with more information.
I am looking for solution for a problem which might not exist the way I am trying to do it. So if anyone can help me with the best way of doing this.
ISSUE:
I have the following input field:
<input type="text" placeholder="quote" ng-model="person.quotes.quote">
<input type="text" placeholder="author" ng-model="person.author">
<input type="text" placeholder="category" ng-model="person.category">
And I have the following object:
$scope.person = {
author: $scope.author,
category: $scope.category,
quotes: [{quote: $scope.quote}]
};
I am trying to get the value person.quote into the array of quotes. But I can't seem to do it.
REASON:
The reason why I am doing this is that when a user fills the input fields and clicks on a button the values are saved into the $scope.person object. And that I push that entire object to my firebase API. I want to maintain the structure of my $scope.person object as I have described in my javascript the same in my firebase API. I can easily push author and category but the nested quotes objects are not being pushed.
THE ERROR I GET:
Error: Firebase.set failed: First argument contains undefined in property 'quotes.0.quote'
Thanks in advance and if this information is not enough please let me know so i can provide with more information.
Share Improve this question asked Nov 27, 2014 at 21:43 SkywalkerSkywalker 5,20417 gold badges66 silver badges127 bronze badges1 Answer
Reset to default 5the property quotes
from object person
is array.
ng-model="person.quotes[0].quote"