如何在AngularJS中为可编辑添加第三个按钮?

时间:2015-09-15 05:58:52

标签: angularjs

我对AngularJS可编辑框架有疑问。使用可编辑时,会出现两个按钮:保存按钮和取消按钮。但是,我想要第三个按钮(带有减号)来删除可编辑的文本。如何添加第三个删除按钮?

以下是我之前提出的一个问题:

Example with only two buttons

using Microsoft.Office.Core;
using Microsoft.Office.Interop.PowerPoint;

private AxOfficeViewer.AxOfficeViewer axOfficeViewer1;
private Microsoft.Office.Interop.PowerPoint.Presentation _presentation;

public void OpenDocument(string fileName)
{
    axOfficeViewer1.Visible = false;

    axOfficeViewer1.Open(fileName);
    axOfficeViewer1.Visible = true;
    axOfficeViewer1.SlideShowPlay(false, false, false, false);

    _presentation =
        axOfficeViewer1.ActiveDocument as Presentation;
}

1 个答案:

答案 0 :(得分:1)

不要认为他们现在支持这一点。 我自己做过。

var app = angular.module("app", ["xeditable"]);

    app.run(function (editableOptions) {
        editableOptions.theme = 'bs3';
    });

    app.controller('Ctrl', function ($scope) {
        $scope.user = {
            name: 'awesome user'
        };

        $scope.showClear = function () {
            $scope.show = true;
        }

        $scope.empty = function () {
            $scope.user.name = "";
            $scope.show = false;
        }
    });

<h4>Angular-xeditable Text (Bootstrap 3)</h4>
<div ng-app="app" ng-controller="Ctrl">
    <span href="#" editable-text="user.name" ng-click="showClear()">{{ user.name || 'empty' }}</span>
    <button class="btn btn-default" ng-click="empty()" ng-show="show">
        -
    </button>
</div>

希望这会有所帮助:)。