1

How can I pass a data from component to view child element. e.g This the variable that I have declared on component:

@ViewChild('warningNotification', { static: false }) warningNotification: jqxNotificationComponent;
public test: string = "NIshan";

Now I have a element on html page

<jqxNotification #warningNotification
             [template]="'warning'"
             [blink]="false"
             [autoOpen]="false"
             [autoClose]="true"
             [closeOnClick]="true"
             [position]="'top-right'"
             [opacity]="0.9"
             [width]="'auto'">
<div><span>
        {{test}}
</span>
</div>
</jqxNotification>

but {{test}} this section not rendering any text. How can I solve this

3
  • @Exomus - I don't have @Input instead I have @VIewChild please have a look at my updated question thank you Commented Nov 6, 2019 at 15:17
  • I think you should close the tag <jqxNotification></jqxNotification> Commented Nov 6, 2019 at 15:25
  • @FatemeFazli - tag is already closed Commented Nov 6, 2019 at 15:29

1 Answer 1

1

In

ngAfterViewInit(){
  this.warningNotification=this.test
}

NOTE: is possible you need enclosed in a setTimeout to avoid error "change after checked"

ngAfterViewInit(){
   setTimeout(()=>{
      this.warningNotification=this.test
   })
}
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.