0

私は、次の.js.coffeeファイルがあります。ルビー - ActionView ::テンプレート::エラー(でSyntaxError予期しない場合)のCoffeeScript

$('#search-results').html('<%= j render @articles %>'); 

$(document).ready() -> 
    dialog = document.querySelector('dialog'); 

    if (!dialog.showModal) { 
    dialogPolyfill.registerDialog(dialog); 
    } 

    dialog.showModal(); 

    dialog.querySelector '.close', addEventListener 'click',() -> 
    dialog.close(); 

は、エラーが発生するのはなぜですか

答えて

0

CoffeeScriptでは、中括弧の代わりにインデントを使用します。

if (!dialog.showModal) 
    dialogPolyfill.registerDialog(dialog) 

if (!dialog.showModal) { 
    dialogPolyfill.registerDialog(dialog); 
} 

を交換し、私はありがとうdocumentation

+0

通過することをお勧めします!以前はコーヒーを一度も使用していなかったという無知を言います。 –

+0

@MatiasCarpintini。問題ありません)http://coffeescript.orgにアクセスしてアイデアを入手してください –

関連する問題