How to check whether ng-content exists [duplicate]

If you have a parent element of <ng-content> with a template variable (#panelHeading) <div class=”panel panel-default”> <div class=”panel-heading” #panelHeading [hidden]=”!showHeading”> <ng-content select=”my-panel-heading”></ng-content> </div> <div class=”panel-body”> <ng-content select=”my-panel-content”></ng-content> </div> </div> then you can query for it like @ViewChild(‘panelHeading’) panelHeading; and set a property depending on whether there are children or not constructor(private cdRef:ChangeDetectorRef) {} showHeading:boolean = … Read more

Check if template exists before rendering

The service holding the twig engine if configured as default is ‘templating’. Inside your Controller do the following: if ( $this->get(‘templating’)->exists(‘AcmeDemoBundle:Foo:bar.html.twig’) ) { // … } The alternative would be catching exception the render() method throws like this: try { $this->get(‘templating’)->render(‘AcmeDemoBundle:Foo:bar.html.twig’) } catch (\Exception $ex) { // your conditional code here. } In a normal … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)