-
-
Save LennardF1989/d37f0a6e3159ba3581999117ad717c70 to your computer and use it in GitHub Desktop.
Beyond Umbraco - Hooking AngularJS (again)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module("umbraco.directives").config(function ($provide) { | |
$provide.decorator("umbTagsEditorDirective", function ($delegate) { | |
var directive = $delegate[0]; | |
//TODO | |
return $delegate; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var originalController = directive.controller; | |
directive.controller = function ($rootScope, assetsService, umbRequestHelper, angularHelper, $timeout, $element) { | |
//originalController.call(this, $rootScope, assetsService, umbRequestHelper, angularHelper, $timeout, $element); | |
originalController.apply(this, arguments); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var originalAddTag = this.addTag; | |
this.addTag = function() { | |
var vm = this; | |
vm.tagToAdd | |
.split(" ") | |
.forEach(x => addSingleTag(x)); | |
function addSingleTag(x) { | |
vm.tagToAdd = x; | |
originalAddTag(); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//NOTE: Copied from umbtagseditor.directive.js | |
this.addTagOnEnter = function(e) { | |
var code = e.keyCode || e.which; | |
if (code === 13) { | |
var vm = this; | |
if ($element.find(".tags-" + vm.inputId).parent().find(".tt-menu .tt-cursor").length === 0) { | |
e.preventDefault(); | |
vm.addTag(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment