I've been working on this for hours and a solution eludes me. The forum has a few threads with similar issues and I've attempted to follow and posted solutions but the results have the same.
Basically I
pull data from Facebook into the view model which then instantiates a
Caller object. In the View, there is a data bind to a Caller property.
Everything works smoothly except the console throws the error with a
reference to the data-bind:
Uncaught Error: Unable to parse bindings.
Message: ReferenceError: caller_name is not defined;
Bindings value: text: caller_nameI appreciate any help - thanks.
Here is the view:<p>Hello, <span data-bind="text: caller_name"> </span></p>
Here is the view model controller & friend object:(everything seems to work here)
function Caller(caller_data) {
var self = this;
self.id = ko.observable(caller_data);
self.caller_name = ko.observable();
self.getCaller = ko.computed(function() {
FB.api('/' + caller_data, {fields: 'name, id, picture'}, function (response) {
//I can see all the data returned by FB with this call
})
})
}
function ModelView (data_data) {
var self = this;
self.friendLists = []
self.init = function () {
FB.api('/me/friendlists', function (response) {
for (var prop in response.data) {
if (response.data[prop].list_type === "test1" || response.data[prop].list_type === "test2") {
FB.api('/' + response.data[prop].id + '/members', function (member_response) {
if (member_response.data.length > 0) {
for (var i in member_response.data) {
for (var k in member_response.data[i]) {
if (k == 'id') {
nameOfList.push(member_
response.data[i].id)
}
}
}
self.friendLists.push(nameOfList)
console.log("self.friendLists().length " + self.friendLists().length);
self.friend = new Friend(self.friendLists()[0][0])
}
})
}
}
})
};
self.init();
}