I started to work in Angular few days ago, and I have a problem that I don't know how to fix. My website is calling a controller.js and this controller calls to an ajax function. The ajax function sent back a correct response, but I can't see it in the web. Here is the code:
var myApp = angular.module('myapp',[]);
myApp.controller('ResolveProduct', ['$scope', function($scope) {
productInformation = function($scope) {
var something;
$.ajax({
type: "GET",
dataType : "json",
async : true,
url : "/ajax/reference/200-B2",
success : function(data) {
something = data.david;
alert(JSON.stringify(something));
$scope.helper = JSON.stringify(something);
},
complete : function($scope) {
$scope.helper = JSON.stringify(something);
alert($scope.helper);
}
});
};
}]);
This sent me a correct answer, but when I do this in the HTML I don't see the answer. (Even if the alert has all the info)
<div ng-controller="ResolveProduct">
<input ng-model="info"></input> information is: {{ $scope.helper }}
<input type="button" id="commitAction" class="slim-button" value="Resolve" onclick="productInformation('')"/>
</div>