Struggling to retrieve values from data binding while generating HTML from an API.
<div class="content-fluid ng-scope" id="angular_template">
<div class="row">
<div class="col-md-6">
<label class="col-md-12">First Name</label>
<input type="text" ng-model="frm1.first_name" class="textboxStyle col-md-6 form-control" placeholder="first name">
</div>
<div class="col-md-6">
<label class="col-md-12">Last Name</label>
<input type="text" ng-model="frm1.last_name" class="textboxStyle col-md-6 form-control" placeholder="last name">
</div>
</div>
</div>
<input type="button" ng-click="save(frm1)" value="Submit" />
Controller:
mod.controller('CreateSimpleFormController', function($scope, $http) {
$http.get('<url>').success(function(response) {
var angularTemplate = response;// html string
document.getElementById("angular_template").innerHTML = angularTemplate;
}).error(function(error) {
console.log('error', error);
}).finally(function() {});
$scope.save = function(data){
console.log(data);
console.log($scope.frm1.first_name);
}
});
Encountering 'undefined' when clicking the submit button. Seeking assistance in identifying my mistake.