anuiq
anuiq

Reputation: 119

Use angular material to make a popup

I have the following code that opens up a pop up and displays information returned by the function //showDetails(Data.path)// when we click on the icon.

  <a ng-show="Data.path" ng-click="showDetails(Data.path)">

      <ng-md-icon icon="info" style="fill: green" size="15"></ng-md-icon>
 </a> 

I want the data to appear in a md-dialog modal window. Is there an easy way to do that ?

Upvotes: 0

Views: 1952

Answers (2)

badikumar
badikumar

Reputation: 807

If you are using ng-include for your modal, remember Angular creates a new child scope for it. You can acess the data in the modal using the following in your modal HTML:

{{$parent.Data.path}}

Upvotes: 0

ngDeveloper
ngDeveloper

Reputation: 1304

You have to setup a controller which tells $mdDialog what it needs to do when the showDetails(...) function is triggered.

See: https://material.angularjs.org/latest/demo/dialog (Click "View Source" <> icon, and then switch to the "JS" tab to see an example of controller code to use; or just go straight to the Codepen).

Upvotes: 1

Related Questions