Following the code snippet of the control that I am creating. This control is used in various places and the variables differ.
I am trying to write a directive to clean up code, but getting a parse error while inserting values near {{}}.
New to angular and not able to pin point what is it that I am missing. Please help.
track-edit is another directive.
Original control code:
<div id="text-wrapper">
<div track-edit="true" id="Type1Desc_{{t1Card.id}}" class="textbody" ng-blur="SaveDesc('Type1Desc_'+t1Card.id,t1Card.Description,'Type1')">
<div>
<p><div spellcheck="true" ng-bind-html="t1Card.OrigDescription|diff:t1Card.Description"></div></p>
</div>
</div>
</div>
Directive code
app.directive('customEditor', function () {
return {
restrict: "E",
scope: {
fId: "@",
idAppend: "@",
className: "@",
origVal: "@",
currVal: "@"
},
replace: true,
transclude: false
template: ' <div id="text-wrapper"><div track-edit="true" id="{{idAppend}}_{{fId}}" ' +
'class="{{className}}" ><div><p>' +
'<div spellcheck="true" ng-bind-html="{{origVal}}|diff:{{currVal}}"></div></p></div></div></div>',
link: function (scope, element, attrs) {
}
}
});
Html after directive:
<custom-editor fid="{{t1Card.id}}" idappend="Type1Desc" classname="textbody" ng-blur="SaveLineItemDesc('Type1Desc_'+t1Card.id,t1Card.Description,'Type1')" origVal="{{t1Card.OrigDescription}}" currVal="{{t1Card.Description}}">
</custom-editor>