my UI has two buttons one for Create and another for Edit.
I used same pop-up for create and Edit actions
create_quick_link.html
<div class="row-fluid">
<div class="form-group">
<label class="control-label col-sm-4">
<font class="pull-right">Name</font>
<span class="red pull-right">*</span>
</label>
<input placeholder="Name" type="text" ng-model="quickLink.name">
</div>
<div class="form-group">
<label class="control-label col-sm-4">
<font class="pull-right">URL</font>
<span class="red pull-right">*</span>
</label>
<input placeholder="URL" type="text" ng-model="quickLink.url">
</div>
</div>
$scope.editQuickLink = function (editableQuickLinkdata) {
$scope.quickLink.name = editableQuickLinkdata.quickLinkName;
$scope.quickLink.url = editableQuickLinkdata.quickLinkUrl;
createDialog({
templateUrl: '/app/ajs/followup/app/views/create_quick_link.html',
title: 'Edit Quick Link',
controller: 'FollowupssettingsCtrl',
footerTemplate: '<button class="btn btn-primary" ng-click="updateQuickLink(quickLink)">Update</button>'
});
}
I want to set the editableQuickLinkdata to quickLink
My data is not populated .am i doing wrong ?
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
}]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With