Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

174
Views
Angular Material2 MdDialog load at the end

Hello i am making a dialog with angularMaterial2 for typescript and i can generate the dialog, but this load at the end of the page not over the other elements like this is expected.

This is my .TS

import { Component, OnInit, Input } from '@angular/core';
import {Sponsor} from '../entitys/sponsor'
import {MdDialog, MdDialogRef} from '@angular/material';

@Component({
  selector: '[sponsor-tile]',
  templateUrl: './sponsor-tile.component.html',
  styleUrls: ['./sponsor-tile.component.css']
})

export class SponsorTileComponent implements OnInit {

  @Input() sponsor: Sponsor;

  constructor(public dialog: MdDialog) {}

  ngOnInit() {
    console.log(this.sponsor);
  }

  descModal(): void{
    let dialogRef = this.dialog.open(DialogSponsorTileComponent);
    dialogRef.afterClosed().subscribe(result => {
      console.log(result);
    });
  }

}

@Component({
  selector: 'dialog-sponsor-tile',
  templateUrl: './dialog-sponsor-tile.html'
})
export class DialogSponsorTileComponent{
  constructor(public dialogRef: MdDialogRef<DialogSponsorTileComponent>){}
}

and my HTML:

<img src="{{sponsor.Logoogo}}" class="speaker-img">
<h3>{{sponsor.Name}}</h3>
<p (click)="descModal()" >{{sponsor.Description}}</p>
<ul class="speaker-social">
  <li *ngIf="sponsor.Facebook !== null" ><a href="{{sponsor.Facebook}}"><span class="ti-facebook"></span></a></li>
  <li *ngIf="sponsor.Twitter !== null" ><a href="{{sponsor.Twitter}}"><span class="ti-twitter-alt"></span></a></li>
  <li *ngIf="sponsor.Linkedin !== null" ><a href="{{sponsor.Linkedin}}"><span class="ti-linkedin"></span></a></li>
</ul>

And the HTML of the Dialog:

<h1 md-dialog-title>Dialog</h1>
<div md-dialog-content>What would you like to do?</div>
<div md-dialog-actions>
  <button md-button (click)="dialogRef.close('Option 1')">Option 1</button>
  <button md-button (click)="dialogRef.close('Option 2')">Option 2</button>
</div>

I made that in base at the examples of material.angular.io

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I think there must not have [ ] in selector: '[sponsor-tile]'

that is, like this: selector: 'sponsor-tile',

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!