banerjee196 banerjee196 - 8 months ago 59
AngularJS Question

Cant get value from ng-model?

im using this account because im logged in on facebook on my other and i dont have my phone with me to do the pass code verification ect..

Anyway.. Im trying to get the value from a ng-model but i just cannot seem to get it no matter what i try. I think i need some other eyes to have a quick look at my code to see if they can work it out, Cheers...


<div class="form-group"><label class="col-sm-2 control-label">Established :</label>
<div class="col-sm-10"><input type="text" class="form-control" ng-model="established"></div>

<button class="btn btn-primary " style="float:right;" ng-click="saveApprisalDetails()" type="button"><i class="fa fa-paste"></i> Save</button>


var urlgetappraisals = './dbscripts/getAppraisalsByRef.php?ref=' + ref
method: 'GET',
url: urlgetappraisals
}).success(function(data) {

$scope.appraisaldetails = data;

var url = './dbscripts/saveApprisal.php?id=' + data[0].id;
url += '&appraisalCompany=' + appraisalCompany;
url += '&title=' + ref;
url += '&established=' + $scope.established;


method: 'GET',
url: url
}).success(function(data) {


Maybe try something different to see if it works, in the begginning of the controller:

$scope.view_data = {};

In the function:

url += '&established=' + $scope.vies_data.established;

And in the view:

<input type="text" class="form-control" ng-model="view_data.established">

Hope it helps =)