[英]How to pass value in angular 2 selector using variable?
I want to pass value to selector of angular like below. 我想将值传递给如下所示的角度选择器。 What is different in this question is that I am passing the variables to selector properties of child component.
这个问题的不同之处在于,我将变量传递给子组件的选择器属性。
<app-jform
[modulename]="'({{modulename}})'"
[tabpgrpid]="'({{tabpgrpid}})'"
[tabgrpname]="'({{tabgrpname}})'"
[usertabgrpname]="'({{usertabgrpname}})'"
[moduleid]="'({{moduleid}})'"
[templateid]="'({{templateid}})'">
</app-jform>
here modulename, tabgrpid, tabgrpname etc. are variables defined and assigned in component. 这里,modulename,tabgrpid,tabgrpname等是在组件中定义和分配的变量。 I am getting the following error while doing this.
执行此操作时出现以下错误。
Parser Error: Got interpolation ({{}}) where expression was
expected at column 1 in ['{{modulename}}'] in
ng:///AppModule/ViewBaseComponent.html@65:3 ("
<app-jform
[ERROR ->][modulename]="'{{modulename}}'"
[tabpgrpid]="'{{tabpgrpid}}'"
[tabgrpname]="'{{tabgrpname}}'"
"): ng:///AppModule/ViewBaseComponent.html@65:3
how to pass this variables to properties of selector? 如何将此变量传递给选择器的属性?
Just pass without the annotation 只是不加注解而通过
<app-jform [modulename]="modulename"
[tabpgrpid]="tabpgrpid"
[tabgrpname]="tabgrpname"
[usertabgrpname]="usertabgrpname"
[moduleid]="moduleid"
[templateid]="templateid">
</app-jform>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.