Show Object in input text using STRINGIFY
Show Object in input text. using JSON.stringify(obj)
by Mayank Dixit
HTML
<div ng-controller="mainCtrl">
<input type="text" value="{{stringer(temp)}}"/>
</div>
JavaScript
angular.module("myApp", [])
.controller("mainCtrl", function($scope){
$scope.temp = {"x": "mayank", "y": {"z": "temp"} };
$scope.stringer = function(obj){
return JSON.stringify(obj)
}
setTimeout(function(){$scope.temp = {"x": "jkl"}; $scope.$apply();}, 1000);
})