2

Actually my requirement is want to create form controls like textbox, dropdown, date/time picker etc..

The above controls i want create using JSON , I will have all the Meta Data in the form of JSON. Using that JSON i can able to create the controls using Angular Directive, Now i want to modify the any of the controls in the VIEW I need to change the Control as well as the JSON. Here i need to use two way binding.

Please anyone help me to achieve this or Provide any examples likewise.

Thanks in advance.

1 Answer 1

2

I'm not sure if I understand the question, but if you're just needing to convert an object literal on your scope to JSON, angular.toJson should fit your needs.

$scope.object = {
    foo: 'bar'
}

var result = angular.toJson($scope.object);

Bind $scope.object to your control using ng-model and use angular.toJson in your controller to convert the scope object to JSON to use elsewhere as needed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.