2016-03-24 4 views
1

をsystemjs:オーレリアとselectize.jsを使用して、私はアウレリアで<a href="https://github.com/selectize/selectize.js" rel="nofollow">Selectize</a>を使用して、エラーを取得維持しようとしている

キャッチされない(約束で)はTypeError:$(...)selectizeは関数ではありません(...)

私はjqueryのは、index.htmlの中にスクリプトタグを介してロードされていて、単純なコンポーネントでselectizeをロードしようとしている:

EventForm.html

<template> 
    <div> 
     <label for="eventTitle">Title</label> 
     <input type="text" id="eventTitle"> 
    </div> 
    <div> 
     <label for="eventType">Sport</label> 
     <select id="eventType"> 
      <option>Event 1</option> 
      <option>Event 2</option> 
      <option>Event 3</option> 
     </select> 
    </div> 
</template> 

EventForm.js

'use strict'; 
import 'jspm_packages/github/selectize/[email protected]/dist/js/standalone/selectize'; 

export class EventForm { 
    constructor(){ 

    } 

    attached() { 
     $('#eventType').selectize({ 
      create: true, 
      sortField: { 
       field: 'text', 
       direction: 'asc' 
      }, 
      dropdownParent: 'body' 
     }); 
    } 
} 

index.htmlを

. 
. 
. 
<script type="text/javascript" src="jspm_packages/system.js"></script> 
<script type="text/javascript" src="config.js"></script> 
<script type="text/javascript" src="jspm_packages/npm/[email protected]/dist/jquery.min.js"></script> 
. 
. 
. 

私はこれがsystemjsロードで行うことがより多くを持っていることを感じているが、同じ結果とのindex.htmlにselectizeをロードしようとしています。誰かが私が間違っていることを指摘してくれますか? jqueryのを使用して2.2.1

おかげ

答えて

1

は約jqueryhttps://stackoverflow.com/a/34772020/3436921

についてselectize:ちょうどselectizeためconfig.jsでマップをチェックし、私はあなたがimport "selectize"またはimport "selectize.js"

+0

すべてのようにそれをインポートする必要があるとしています正しいと選択してロードするだけでjquery要素のプロトタイプを期待通りに拡張しない – weagle08

+0

私の例は、jqueryとjqueryプラグインを使用するために推奨される方法で動作しています。スタンドアロン版ではなく、jspmパッケージの名前に応じてselectize.js ''または '' import "' selectize "を' 'import ''するときにロードされる'/dist/js/selectize.js' – valichek

関連する問題

 関連する問題