Reputation: 221
ng-bind is not binding data if I assign a var for it. Why?
var output = $scope.output;
output = JSON.stringify(txt);
Plnkr : --> http://plnkr.co/edit/srYQnpHudt7gfeOXN1ff?p=preview
Upvotes: 0
Views: 57
Reputation: 4773
http://plnkr.co/edit/3VRAlVS63bqSXxTd5l0N?p=preview
Is this what you wanted:
app.controller('cCtrl', function($scope) {
$scope.generate = function () {
var txt = $scope.objInput;
var output = JSON.stringify(txt);
$scope.output = output ;
};
});// Fin qCtrl
Upvotes: 2
Reputation: 71
You didn't assign the variable to ng-bind, I have changes this way, here the objInput is assigned txt and then its converted to string and then stored to output variable and then assigned scope variable output.
$scope.generate = function (){
var txt = $scope.objInput;
var output = JSON.stringify(txt);
$scope.output = output;
};
Hope this helps.
Upvotes: 0