vendredi 10 avril 2015

Dont sent the $scope to the html

Hi friends I started to work in Angular few days ago, and I have this problem that I dont know how to fix it. My web is calling a controller.js and this controller call to an ajax function. The ajax function sent back a correct response, but I can't see it in the web. Here is the codes:



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 on HTML I dont see the answer. (Even if the alert have 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>


Someone can help me please?


Aucun commentaire:

Enregistrer un commentaire