So I want to get a value from function, which uses Firebase. After it, I want to use this value in a view.
My Angular function:
$scope.getCurrentIndex = function(companyName){
var indexRef = new Firebase('https://xxxxx-stock.firebaseio.com/'+companyName);
indexRef.on("value", function(Index){
return Index.val()
})
};
My FB looks like:
apple
|_160
And HTML:
<div ng-init="Index = getCurrentIndex('apple')">
<h2>Apple: {{Index}}</h2>
</div>
But in view there is only Apple: