How to open popover for update my record in ANgularjs

孤人 提交于 2019-12-25 07:02:18

问题


Friends,

I waant to update my record using popover and i have to used angularjs directive.my popover is open but data not populated in textbox and update button click not working below my cod which i used

SCRIPT :

var mymodal = angular.module('mymodal', []);

mymodal.controller('MainCtrl', function ($scope) {

    $scope.days = [{ 'ID': 1, 'name': 'Sunday' },
        { 'ID': 2, 'name': 'Monday' },
        { 'ID': 3, 'name': 'Tuesday' },
        { 'ID': 4, 'name': 'Wednesday' },
        { 'ID': 5, 'name': 'Thursday' },
        { 'ID': 6, 'name': 'Friday' },
        { 'ID': 7, 'name': 'Saturday' }];

    $scope.editSave = function () {
        alert('Update!');
    }

    $scope.ProphenDelete = function () {
        alert('Delete!');
    }

});

mymodal.directive('bsPopover', function () {

    return function (scope, element, attrs) {
        var popOverContent = "<modal title='Add/Update/Delete'>"
                                + '<form role="form">'
                                + '<div class="form-group">'
                                + '<input type="text" class="form-control" id="txt" ng-bind="modedit.editProfaneWord" ng-model="editProfaneWord"/>'
                                + '<input type="hidden" name="someData"  ng-model="ID" /> '
                                + '</div>'
                                + '<button class="btn btn-primary" ng-click="editSave()">Save</button>&nbsp;'
                                 + '<button class="btn btn-primary" ng-click="ProphenDelete()">Delete</button>'
                                + '</form></modal>';
        element.find("a[rel=popover]").popover({
            placement: 'bottom',
            html: 'true',
            content: popOverContent,
            title: attrs.popoverPlacement
        });
    };


});

HTML :

<div ng-app="mymodal">
<div ng-controller="MainCtrl" class="container">
      <table>
        <tr ng-repeat="cust in days" bs-popover>
            <td>
                <a rel="popover" ng-bind="cust.name"></a>
            </td>
        </tr>
    </table>
</div>

来源:https://stackoverflow.com/questions/32263313/how-to-open-popover-for-update-my-record-in-angularjs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!