Arepalli Praveenkumar
Arepalli Praveenkumar

Reputation: 1306

How to pass dynamic data to template when createDialog used

my UI has two buttons one for Create and another for Edit.

I want to set the editableQuickLinkdata to quickLink

My data is not populated .am i doing wrong ?

Upvotes: 5

Views: 911

Answers (1)

Arepalli Praveenkumar
Arepalli Praveenkumar

Reputation: 1306

You can do it as follows:

$scope.editQuickLink = function (editableQuickLinkdata) {
    createDialog({
        templateUrl: '/app/ajs/followup/app/views/create_quick_link.html',
        title: 'Edit Quick Link',
        controller: 'EditCtrl',
        footerTemplate: '<button class="btn btn-primary" ng-click="updateQuickLink(quickLink)">Update</button>'
    },{myOldData: editableQuickLinkdata});

}

Then in the EditCtrl, in addition to $scope, you will get myOldData as an argument :

angular.module('MyApp').controller('EditCtrl', ['$scope', 'myOldData',
function($scope, myOldData) {
 // Do stuff 
}]);

Upvotes: 4

Related Questions