Skip to content

Passing local data to md dialog??? #2086

Closed

Description

@dreweird

----in my html code---
<td *ngIf="item.clickable=='yes'" (click)="openDialog(item)">{{item.kilo[0] | number: '1.2-2'}}</td>

---in my component code---

 openDialog(item) {
    let dialogRef = this._dialog.open(DialogContent);

    dialogRef.afterClosed().subscribe(result => {
      this.lastDialogResult = result;
    })
  }

How to show the local variables in the md-dialog template???? I want to display the value of item

@Component({
  template: `
    <p>This is a dialog</p>
    <p>
    {{item}}
      <label>
        This is a text box inside of a dialog.
        <input #dialogInput>
      </label>
    </p>
    <p> <button md-button (click)="dialogRef.close(dialogInput.value)">CLOSE</button> </p>
  `,
})
export class DialogContent {
  constructor(@Optional() public dialogRef: MdDialogRef<DialogContent>) { }
}

Activity

  1. crisbeto commented on Dec 6, 2016

    @crisbeto
    Member

    Try the suggestion from here. We should probably document this option a little bit better.

    EDIT: Seems like we already have #1947 to keep track of this. I'll close the issue as a dupe.

  2. self-assigned this
    on Dec 6, 2016
  3. added
    docs
    on Dec 6, 2016
  4. angular-automatic-lock-bot commented on Sep 5, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  5. locked and limited conversation to collaborators on Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

docs

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions