Skip to content
This repository has been archived by the owner on Nov 19, 2021. It is now read-only.

Commit

Permalink
Fix: model bug in emoji-removable #4
Browse files Browse the repository at this point in the history
  • Loading branch information
terranisu committed Apr 24, 2015
1 parent 176b437 commit 11e9696
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion dist/js/emoji-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,10 @@ angular.module('vkEmojiPicker').directive('emojiRemovable', function () {
};

var rebindClick = function () {
if ($scope.model == null) {
return;
}

var words = $scope.model.split(/\s+/);
var emojis = element[0].querySelectorAll('i.emoji-picker');
var mapping = createMapping(words, emojis);
Expand All @@ -1413,7 +1417,7 @@ angular.module('vkEmojiPicker').directive('emojiRemovable', function () {
emojiElement.on('click', function () {
words.splice(mapping[key], 1);
$scope.model = words.join(' ');
emojiElement.off();
emojiElement.scope().$destroy();
emojiElement.remove();
$scope.$apply();
});
Expand Down
Loading

0 comments on commit 11e9696

Please sign in to comment.