date - how to popup window using angularjs -
i want dialog comes on button click , ask 2 dates enter , give me days difference on page on label using angularjs. can me on this?
i tried using @user3360944 example , works me, how can select multiple items popup , add table on parent page? here code
parent template : mainpage.html
<div ng-controller="itemctrl" class="modal-body"> <button class="btn btn-default" ng-click="open();">open dialog</button> <div ng-show="selected">{{ selected.name}}</div> </div>
popup template : itemselectdlg.html
<table class="table table-hover grid"> <thead class="tableheader"> <tr> <th>name</th> <th>type</th> <th>payment</th> </tr> </thead> <tbody> <tr ng-repeat="item in items" ng-click="selected.item = item"> <td>{{item.name}}</td> <td>{{item.type}}</td> <td>{{item.payment}}</td> </tr> </tbody> </table> selected: <b>{{ selected.item.name }} </b> <div class="modal-footer"> <button class="btn btn-primary" ng-click="ok()">ok</button> <button class="btn btn-warning" ng-click="cancel()">cancel</button> </div>
script code :itemctrl
$scope.items = $scope.productset[0].items; $scope.open = function () { var modalinstance = $modal.open({ templateurl:'itemselectdlg.html', controller: modalinstancectrl, resolve: { items: function () { return $scope.items; } } }); modalinstance.result.then(function (selecteditem) { $scope.selected = selecteditem; }, function () { //cancel }); }; var modalinstancectrl = function ($scope, $modalinstance, items) { $scope.items = items; $scope.selected = { item: $scope.items[0] }; $scope.ok = function () { $modalinstance.close($scope.selected.item); }; $scope.cancel = function () { $modalinstance.dismiss('cancel'); }; };
Comments
Post a Comment