JSFiddle - React, Tailwind, and code Playground
by DEEPAK SHARMA
HTML
<div ng-app="myapp">
<div ng-controller="mycontroller">
<div id="settingsholder" ng-controller="mycontroller">
<input ng-model="user.firstName" />
<input ng-model="user.lastName" />
<p>
Using angular json filter :: {{user | json}}
</p>
<p>
Using Controller function
</p>
<input type="button" ng-click="showJson()" value="convert to json " />
{{jsonStringified}}
</div>
</div>
</div>
JavaScript
var app = angular.module('myapp', []);
app.controller('mycontroller', function($scope) {
$scope.user = {
firstName: "Frank",
lastName: "Williams"
};
$scope.showJson = function() {
$scope.jsonStringified = angular.toJson($scope.user, true);
}
})