I'm experiencing an error that says "Cannot set property '$render' of undefined" and I can't seem to solve it, even though I know similar questions have been asked before.
$scope.editmode = false;
$scope.toggleEditMode = function () {
$scope.editmode = $scope.editmode === false ? true : false;
}
directives.directive("contenteditable", function () {
return {
link: function(scope, element, attrs, ngModel) {
function read() {
ngModel.$setViewValue(element.html());
}
ngModel.$render = function() {
element.html(ngModel.$viewValue || "");
};
element.bind("blur keyup change", function() {
scope.$apply(read);
});
}
}; });
<tr dir-paginate="us in zdravstveniPostupci | filter: {Postupak: nasUser} | orderBy:orderByField:reverseSort | itemsPerPage:selectedMenu" ng-dblclick="updateOsoba(us, selectMjesto )" on-long-press="updateOsoba(us, selectMjesto )" ng-click="odaberiOsobe(us,$index)" ng-attr-contenteditable="{{ editmode }}">
<td ng-repeat="key in draggableObjects" ng-if="key.visible" >
<span ng-if="key.name!='Mjesta'"> {{us[key.name]}}</span>
</td>
</tr>
<div class="col-md-4 center-block" style="position:fixed;top:36%;left:82%;" id="gumbicc">
<button type="button" class="btn btn-responsive" ng-click="toggleEditMode(); ShowHide()" >{{editmode ? 'Disable Editing' : 'Enable Editing'}}</button></div>