needim / wdt-emoji-bundle

Slack like emoji picker with apple/ios, twitter/twemoji, google, emojione, facebook, messenger emoji support
http://ned.im/wdt-emoji-bundle
MIT License
420 stars 86 forks source link

angularjs integration #2

Open rkimaoui opened 8 years ago

rkimaoui commented 8 years ago

Hi there,

Thank you for this amazing job. How can in integrate the picker with angularjs application ?

i Hope to see an angular version.

Thanks !

chamnap commented 8 years ago

+1

ghost commented 8 years ago

+1

floooat commented 8 years ago

+1

SebMenozzi commented 8 years ago

+1

dylanjha commented 8 years ago

this can be done with a custom directive, I don't think it is within the scope of this library to support a integration into one specific framework

saade commented 8 years ago

Yes... I created a filter who converts plain text in emoji using emojione.shortnameToImage.

something like this:

app.filter('emojify', function() { return function(input) { return emojione.shortnameToImage(input); } });

and used {{ input | emojify }}.

But... If you have to bind html, i suggest to create a custom directive, and link function will come like this..

link: function(scope, element, attrs){ var template = '<div class="post-content"><div class="post-content-text">'+emojione.shortnameToImage(scope.post.text[0])+'</div></div>'; element.append(template); }

Hope it helps Someone :partly_sunny:

SamarRizvi commented 8 years ago

When I import wdt-emoji-bundle.min.js and emoji.min.js (I am using JSPM and es6 style of coding), and then, when I use wdtEmojiBundle.init, I get error "wdtEmojiBundle is not defined"

nageshd3 commented 8 years ago

@Samar that is obvious, since wdtEmojiBundle is not imported. You've to find a way whereby you get access to all the methods inside wdtEmojiBundle object. In angular style for web, I would directly use it as $scope.wdtEmojiBundle.

SamarRizvi commented 8 years ago

@nageshd3 I am using controller as methodology and I have used this.wdtEmojiBundle but still same error.

saade commented 7 years ago

@SamarRizvi if you are using angular 2 with typescript:

you need to declare wdtEmojiBundle with

declare var wdtEmojiBundle:any;

Exponent500 commented 7 years ago

@nageshd3 @SamarRizvi

I am having the same issue as @nageshd3 and I am using angular1. I'm trying to get the emoji picker to display inside of an input field that's found within an html template associated with a controller. When I try to init this bundle in the controller (by way of a simple this.wdtEmojiBundle.init() in the controller, I get the same error that @nageshd3 had.

As others have suggested, it seems this is not meant to be used within an angular app.

LeiwenL commented 7 years ago

Hi, I'm having some issue, I'm trying to install for angular 2 & typescript, but I don't understand how to implement this :disappointed: someone can help me please ?

rajkuttie commented 7 years ago

Same issue here .. ! I can't integrate

Tikoriya commented 7 years ago

My issue is when i want to execute wdtEmojibundle.init(''.my-input-selector") it tells me it's not a constructor :/ And I'm not sure where exactly i could be wrong? Did someone also had the same issue?

needim commented 7 years ago

@VLazzarova Can you try with capital letter of B: wdtEmojiBundle.init

Tikoriya commented 7 years ago

@needim It's actually how I wrote it, wrote it with a typo inhere 🙈 So after i add the scripts and i call my function.. do i have to initialize the wdtEmojiBundle Object somewhere else?

needim commented 7 years ago

@VLazzarova Oh this is an issue about Angular :/ I'm not familiar with Angular :/

Tikoriya commented 7 years ago

@needim I found sth. I think it throws me the error cause of the EmojiConvertor. In the init function it calls this constructor, so it throws me the error it's not a constructor. It actually prints the EmojiConvertor on the console as (and my error is exactly: " is not a constructor") Some thoughts on that may be?

needim commented 7 years ago

@VLazzarova hmm emoji.min.js is a dependency. It's in the repo. Maybe you missed that part?

nageshd3 commented 7 years ago

@VLazzarova check the file emoji.min.js is being loaded when you initialize controller. If you are lazy loading, try to load this library file serially.

Tikoriya commented 7 years ago

@needim yep, that was it! I was loading wdt-emoji-bundle.min.js first and then the emoji.min.js Thank you for the help ! 🙌🏼

needim commented 7 years ago

@VLazzarova nice! I guess I'm not good at documentation section, I will work on that. :/

topseySuave commented 7 years ago

@needim a getting this error what do you think could be the problem..? Uncaught TypeError: Cannot read property 'querySelector' of null at Object.h.init (wdt-emoji-bundle.min.js:16) at

adeopura4 commented 5 years ago

If anyone has been able to make an integration with AngularJS work for the emoji picker, please do share the code/repo.