vitalets / angular-xeditable

Edit in place for AngularJS
http://vitalets.github.io/angular-xeditable
MIT License
1.91k stars 403 forks source link

use xeditable in bind-html-compile #676

Closed HarryF514 closed 7 years ago

HarryF514 commented 7 years ago

is it possible to do this:

Html

<span ng-bind-html="title"></span></span>

JS

scope.name = 'harry';
scope.title = '<a editable-text="scope.name">{{ scope.name || \'empty\' }}</a>';
ckosloski commented 7 years ago

Is it giving you an error when you try that?

HarryF514 commented 7 years ago

it shows empty instead of the string 'harry'

HarryF514 commented 7 years ago

well, I solved this by doing this:

.directive("editDeviceName", function() {
    return {
        scope: {
            text: '='
        },
        template : '<a href="#" editable-text="text">{{ text || \'empty\' }}</a>'
    };
})
scope.name = 'harry';
scope.title = '<edit-device-name text = "name"></edit-device-name>';

<span bind-html-compile="title"></span>

ckosloski commented 7 years ago

OK, thanks for providing your solution. Please close this issue if the solution you provided is satisfactory.