angular - Angular4: Component reference inside ng-template -


i new angular 4. want handle of component(validation-alerts) inside ng-template

<ng-template #content let-c="close" let-d="dismiss" size="600px" >       <validation-alerts  [formgroup]="requesttypeform"></validation-alerts>       <div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix head" tabindex="-1">         <span id="ui-id-6" class="ui-dialog-title popup-title">client name </span>         <button (click)="d('cross click')" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only ui-dialog-titlebar-close"          role="button" aria-disabled="false" title="close">         <span class="ui-button-icon-primary ui-icon ui-icon-closethick popup-close-icon"></span><span class="ui-button-text">close</span>         </button>     </div>     <form (ngsubmit)="onsubmit()" [formgroup]="requesttypeform">     <div id="scrollcontainer-popup" class="popup ui-dialog-content ui-widget-content" style="width: auto; min-height: 0px; max-height: none; height: auto; display: block; padding: 0px 10px 0px">         <div class="body">             <p class="mb"><b>select matching client name:</b></p>             <input type="text" formcontrolname="clientid" name="clientid"                      id="clientid" style="width:30%" />              <div class="btnbar nbdr" style="padding-top: 0px;" >                 <a (click)="c('close')" class="btn3"><span>cancel</span></a>                       <button type="button" class="btn" (click)="c('submit')">select</button>               </div>         </div>     </div>     </form>  </ng-template> 

i tried using @viewchild, @viewchildren getting undefined in aftercontentinit method.

 @viewchild(validationalertscomponent)   private validationalerts: validationalertscomponent; 

component class

@component({   selector: 'provision-modal',   templateurl: 'provision.modal.html',   encapsulation: viewencapsulation.none,   styles : [ '.namelookup .modal-content {  width: 600px;}']  }) export class provisionmodal implements aftercontentinit {   @viewchild('content')  contenttemplate: templateref<any>;     @viewchild(validationalertscomponent)   private validationalerts: validationalertscomponent;       ngaftercontentinit() {      console.log('ng after content init '+ this.validationalerts);   } 


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -