How to execute Angular Expressions values in Directives values in Angular Js.
{{user.name}} is work. But when I use it in Directive ( ng-init ), It wont work.
ng-init="formData.id='{{user.name}}'"
Or any other way?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
ngInitdirective as the name suggest, does initialization tasks, for example if you want to set an user’s name and age data, you can do the following:This is executed before angular starts bootstrapping your app and compiling templates. Expressions surrounded by double curly braces
{{ }}are bindings that tell angular to evaluate an expression and produce output, so if you want to display data previously initialized just add them to your document like this:
Check the very basic example here: http://jsfiddle.net/j9Nfd/