angular - how can I pass data from html to component(angular2) -
this question has answer here:
in index.html can print these (keys,name,email)values
<body> {{keys}} {{name}} {{email} </body> <component-app></component-app>
these flask this
return render_template("index.html",keys=my_keys,name=my_name,email=my_email)
i want pass keys,name,email data component-app, should do?
or can pass data flask angular2's component??
the short answer: no, can't. can create global js variables
<body> <script type="text/javascript"> keys = '{{keys}}' name = '{{name}}' email = '{{email}' </script> </body>
then in component
public keys = window['keys']);
and in angular html
{{ keys }}
Comments
Post a Comment