angularjs - How to pass dynamic data to template when createDialog used -
angularjs - How to pass dynamic data to template when createDialog used -
my ui has 2 buttons 1 create , edit.
create -should show empty fields pop-up edit - existed info should prepopulate pop-upi used same pop-up create , 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 set editablequicklinkdata quicklink
my info not populated .am doing wrong ?
you can 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 editctrl, in add-on $scope, myolddata argument :
angular.module('myapp').controller('editctrl', ['$scope', 'myolddata', function($scope, myolddata) { // stuff }]); angularjs
Comments
Post a Comment