Skip to content

Instantly share code, notes, and snippets.

@kis
Created August 7, 2015 12:50
Show Gist options
  • Save kis/ab43b8889d8f7345df30 to your computer and use it in GitHub Desktop.
Save kis/ab43b8889d8f7345df30 to your computer and use it in GitHub Desktop.
(function() {
'use strict';
angular
.module('uaMain')
.directive('essaysEdit', essaysEdit);
/** @ngInject */
function essaysEdit($sce) {
var directive = {
restrict: 'E',
templateUrl: 'app/pages/athlete/tabs/essays/essays-edit.html',
scope: {
essayItem: '='
},
link: linkFunc
};
return directive;
function linkFunc(scope, elem, attrs, vm) {
scope.essayItem = $sce.trustAsHtml(scope.essayItem);
scope.initialEssayItem = angular.copy(scope.essayItem);
scope.isEdit = false;
scope.edit = function() {
scope.isEdit = true;
}
scope.save = function() {
scope.initialEssayItem = angular.copy(scope.essayItem);
scope.isEdit = false;
//service save
}
scope.close = function() {
scope.essayItem = angular.copy(scope.initialEssayItem);
scope.isEdit = false;
}
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment