jquery-select2typescript1.4

inject select2 in typeScript


I have problem injecting the select2 library in my TypeScript/Angular project. I don't know what else to do to make it working, I searched for some working example of but without success.

Module is injected like that:

public init() {
        var myApp = angular.module('app', [
            'ui.router',
            'ngCookies',
            'ui.bootstrap',
            'select2'
        ]); 
...

I get an error:

Module 'select2' is not available! You either misspelled the module name or forgot to load it.

What am I doing wrong there? Any help appreciated.


Solution

  • So I resolved this by initializing select2 in jQuery style direct in my controller...

    $('select').select2();
    

    It is probably not very nice solution but it works. If anyone got better solution feel free to post it