-2

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. 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?

1 Answers1

2

Just pass without the annotation

<app-jform  [modulename]="modulename"
            [tabpgrpid]="tabpgrpid"
            [tabgrpname]="tabgrpname"
            [usertabgrpname]="usertabgrpname"
            [moduleid]="moduleid"
            [templateid]="templateid">
 </app-jform> 
Sajeetharan
  • 216,225
  • 63
  • 350
  • 396