0
I have the following situation, in View
:
{{nomeCraque}}
and in the Angular
:
$scope.nomeCraque = {};
var EscalacaoObject = Parse.Object.extend("Escalacao");
var query = new Parse.Query(EscalacaoObject);
query.find({
success: function(results) {
// Successfully retrieved the object.
for (var i = 0; i < results.length; i++) {
var object = results[i];
$scope.nomeCraque = object.get("nomeCraque");
}
},
error: function(error) {
alert("Error: " + error.code + " " + error.message);
}
})
In this way $scope.nomeCraque
prints {}
in View
, how do I print on View
the correct result that the Query
is returning?
console.log(object.get("nomeCraque"));
shows what?– OnoSendai
Shows the correct data returned by Parse.Query.
– Ita
$Scope.nameCrac = { name: 'startName' }; in the view {{nameCrac.name}}, then just assign the value by opening $Scope
– Felipe Duarte
Felipe, good morning to you! sorry but I didn’t understand when you say: "assign the value by opening $Scope", how should I assign the value returned from Parse.Query to the variable $Scope.fieldName ?
– Ita
$Scope.nameCrac = { name: Object.get("nameCrac"); }
– Felipe Duarte
may solve your problem
– Felipe Duarte
Felipe, I don’t know if I did something wrong, it follows an excerpt from the ... Start with $Scope.nameCrac = { name: 'startName' }; ... I did value assignment as $Scope.nameCrac = { name: Object.get("startName") } ; Because the way you wrote it, $Scope.fieldName = { name: Object.get("racName"); } causes syntax error when saving code: "Uncaught Syntaxerror: Unexpected token ;" But, unfortunately it hasn’t worked out yet, because in the view it looks like this: {"name":""} DETAIL, in the console.log it looks like this: Object {name: testname} Have any idea why?
– Ita
@Ita in the assignment you cannot close the query with a semicolon, leave with nothing or end with a comma
– Felipe Duarte
OK Felipe, I understand, but regardless of this detail, the problem persists and in the view I can’t get the result returned by Parse.Query, is that there is missing some more procedure to be done?
– Ita