0

How to pass a JSON data to Angular module. This is my code

<div ng-init="init({{post.name}})">
4
  • find working jsfiddle.net/HB7LU/15925 Commented Jul 31, 2015 at 9:42
  • if post.name is a JSON then you can simply pass to the init method <div ng-init="init(post.name)"> Commented Jul 31, 2015 at 9:43
  • Can I pass a single data @Janty @neda? [{"name":"John","age":"21"}, {"name":"Mike","age":"23"}] Example : {{post.name}} = "John" Commented Aug 3, 2015 at 3:22
  • Yes, I have passed single data in jsfiddle. What would you like to pass ? Provide me the sample. I will try to solve it. Commented Aug 3, 2015 at 3:28

1 Answer 1

1
<div ng-init="init({name: post.name})"> 

or if you want to pass all data

<div ng-init="init(post)"> 

JSFiddle

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.