Reputation: 13915
Dialog should include details of currently selected product. How to make it work?
At the moment this doesn't work: <h2>Order: {{product.name}}</h2>
Upvotes: 2
Views: 785
Reputation: 14590
You need to pass locals
property:
In ng-click
add the product:
<md-button class="md-primary md-raised" ng-click="showAdvanced($event, product)">
In the Dialog pass it as locals
:
$mdDialog.show({
controller: DialogController,
templateUrl: 'orderDialog.tmpl.html',
parent: angular.element(document.body),
targetEvent: ev,
clickOutsideToClose: true,
fullscreen: useFullScreen,
locals:{dataToPass: product},
})
In the Controller assign it to the scope
:
var mdDialogCtrl = function ($scope, dataToPass) {
$scope.product = dataToPass
}
Codepen updated
Upvotes: 4