I'm working in Angular with just a plain old JS function that returns a list of data from an API. I then turn the data into radio buttons like this:
function parseRoles(jsonObj) {
console.log("passed: " + jsonObj);
var tempRoleArray = [];
for (var i = 0; i < jsonObj.role.length; i++) {
tempRoleArray.push("<input type='radio' ng-model='user.role' value='" + jsonObj.role[i].role + "'>" + jsonObj.role[i].description + " ");
}
$("#userRoleEntry").html(tempRoleArray);
}
Works great from the JS side but then the Angular side doesn't recognize "user.role" or "$scope.user.role" with "not defined" errors for each. Is this because this input is a little different in the partial? Something else? Seems to be some questions alluding to Angular not really doing these kinds of things all that well... EDIT: This is not the only input in the form. The rest of them have been collected or returned from the API. So not sure I can compile against scope and seems like kind of an overkill answer. I could be wrong about that, of course.
$compile,you could simply do$compile($("#userRoleEntry"))($scope)