I'm setting up two view models in knockout.
$.getJSON("/api/administrators", function (data) {
var AccessViewModel = {
administrators: ko.observableArray(data)
};
ko.applyBindings(AccessViewModel);
});
$.getJSON("/api/roles", function (data) {
var RolesViewModel = {
definedRoles: ko.observableArray(data)
};
ko.applyBindings(RolesViewModel);
});
I'm able to get the information from administrators in the view, but unable to pull anything out of definedRoles. When I add an alert inside of the .getJSON function for roles it is returning data. It seems something is wrong between creating the RolesViewModel and when I call it like so:
<ul data-bind="foreach: definedRoles">
<li data-bind="text: name"></li>
</ul>
Can someone point me in the right direction?